What does signal(SIGPIPE, SIG_IGN); do? What does signal(SIGPIPE, SIG_IGN); do? unix unix

What does signal(SIGPIPE, SIG_IGN); do?


signal(SIGPIPE, SIG_IGN);

simply ignores the signal SIGPIPE. Passing SIG_IGN as handler ignores a given signal (except the signals SIGKILL and SIGSTOP which can't caught or ignored).

As an aside, it's generally recommended to use sigaction(2) over signal(2) as sigaction offers better control and also don't need to "reset" the handler on some systems (which follow the System V signal behaviour).