Disabling SIGPIPE

This little snippet seems like the best way to stop legacy behavior of sockets on POSIX operating systems raising a SIGPIP signal if you write to disconnected socket or pipe.

signal(SIGPIPE, SIG_IGN);

See

How to prevent SIGPIPEs (or handle them properly)

Â