Date: Wed, 19 Mar 2003 01:37:48 -0800 From: Luigi Rizzo <rizzo@icir.org> To: Peter Pentchev <roam@ringlet.net> Cc: net@FreeBSD.ORG, Tristan Goode <tgoode@iprimus.com.au> Subject: Re: write(2) SIGPIPE on a closed socket? Message-ID: <20030319013748.A84035@xorpc.icir.org> In-Reply-To: <20030319093002.GT468@straylight.oblivion.bg>; from roam@ringlet.net on Wed, Mar 19, 2003 at 11:30:02AM %2B0200 References: <20030319093002.GT468@straylight.oblivion.bg>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 19, 2003 at 11:30:02AM +0200, Peter Pentchev wrote: ... > dnscache) getting a SIGPIPE when attempting to write to an incoming > connection's socket. Presumably, the client closed the connection in ... > The question: if the client closed the socket, shouldn't a write(2) > return -1 with errno == EPIPE before sending a SIGPIPE? Does anyone well, what would "before" mean ? the system sends a signal when the error is detected, not after an arbitrary amount of time to give the user a chance of handling the return from the syscall. Sounds like the correct approach is to set the handler for SIGPIPE to sig_ign Maybe one should wonder why this is not just the default given that you can get this signal not because your program did something wrong, but because the other end did. cheers luigi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030319013748.A84035>