Why does SIGPIPE exist?
I don’t buy the previously-accepted answer. SIGPIPE is generated exactly when the write fails with EPIPE, not beforehand – in fact one safe way to avoid SIGPIPE without changing global signal dispositions is to temporarily mask it with pthread_sigmask, perform the write, then perform sigtimedwait (with zero timeout) to consume any pending SIGPIPE signal (which … Read more