On Wed, Oct 05, 2011 at 03:54:00PM -0700, Artem Belevich wrote: > 2011/10/5 Dag-Erling Sm?rgrav <[email protected]>: > > Michael Bushkov <[email protected]> writes: > >> 2. Consequences of the aforementioned problem can probably be > >> corrected by using _setsockopt(..., SO_NOSIGPIPE) in > >> __open_cached_connection() in nscachedcli.c
> > That sounds like a workaround rather than a fix... > Not necessarily. Using SO_NOSIGPIPE is a valid option when someone > wants to see read/write on a closed socket fail and return -1 with > errno=EPIPE. > Quick grep in libc shows that resolver code in > lib/libc/resolv/res_send.c also sets SO_NOSIGPIPE for exactly that > reason. Disabling SIGPIPE is good anyway because a crashing/dying nscd should not cause applications to terminate. However, if EPIPE/SIGPIPE happens in normal operation, that is still a bug that should be fixed. By the way, SO_NOSIGPIPE is not in POSIX.1-2008 while the MSG_NOSIGNAL flag to send() is. It may be better to replace the write() call with send() with the MSG_NOSIGNAL flag and drop the setsockopt(). -- Jilles Tjoelker _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[email protected]"

