cURL / Mailing Lists / curl-library / Single Mail

curl-library

SIGPIPE

From: Giuseppe Attardi <attardi_at_di.unipi.it>
Date: Tue, 2 Dec 2003 10:44:14 +0100

I noticed that when signal SIGPIPE is raised,
the thread involved continues but becomes a zombie.

Looking at the code I noticed for instance
in Curl_write:

      bytes_written = swrite(sockfd, mem, len);
    if(-1 == bytes_written) {
      int err = Curl_ourerrno();

This is where the signal occurrs.
If the signal is discarded, are we sure that swrite() returns -1?

swrite() is indeed just a macro for calling send():

#define swrite(x,y,z) (size_t)send(x,y,z,0)

The fourth argument of send() is a flag, which can be
set to MSG_NOSIGNAL to avoid generating
the SIGPIPE signal.

This looks like a better solution than using signal()
to ignore the signal.

-- Beppe

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-12-02