I know the individual uses of SIGPIPE and SIGIGN.
What does
signal(SIGPIPE, SIG_IGN);
exactly do?
I know the individual uses of SIGPIPE and SIGIGN.
What does
signal(SIGPIPE, SIG_IGN);
exactly 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).