algernon/libmongo-client — pull request #23 by lbudai (2014-03-26 20:24:45+00:00)
Title: tests: be careful when using a broken socket

After shutdown/close the fd should be set to an invalid value
in order to avoid writing to a broken socket.
Result of writing to a broken socket is platform specific.

There are platforms(POSIX.1-2008) which supports MSG_NOSIGNAL flag which
disabling SIGPIPE.

There are platforms which supports SO_NOSIGPIPE which is a socket option
(and can be set with setsockopt; FreeBSD) and which also disable SIGPIPE.

On other platforms(like Solaris, even Oracle Solaris 11) you will get a SIGPIPE
when you try to write to a broken socket.

Signed-off-by: Budai Laszlo