curl-library
Re: SIGPIPE
Date: Tue, 2 Dec 2003 11:02:09 +0100 (CET)
On Tue, 2 Dec 2003, Giuseppe Attardi wrote:
> 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?
My linux man page says (for send):
"Locally detected errors are indicated by a return value of -1."
> 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.
Indeedo. This detail had totally slipped my attention, but it certainly seems
like the right thing to do. The flag doesn't exist on all platforms though.
Solaris and BSD flavours seem to lack it.
See my attached patch for what I'm about to commit.
-- Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/ [[ Do not post private mails to this email address. They won't reach me. ]]
-------------------------------------------------------
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/
- TEXT/PLAIN attachment: no_signal.patch