When compressing output with -z, we do so by creating a child process to
run gzip and pipe to it, and we catch SIGCHLD to clean up after the
child process. We don't want the SIGCHLD to show up as an "Interrupted
system call" error, so we specify that SIGCHLD should restart, rather
than interrupting, system calls.
Aaron Campbell <aaron at arbor dot net>
Alfredo Andres <aandres at s21sec dot com>
Albert Chin <china at thewrittenword dot com>
+ Alexandra Kossovsky <alexandra1975 at sourceforge dot net>
Ananth Suryanarayana <anantha at juniper dot net>
Andrea Bittau <a dot bittau at cs dot ucl dot ac dot uk>
Andrew Brown <atatat at atatdot dot net>
memset(&new, 0, sizeof(new));
new.sa_handler = func;
+ if (sig == SIGCHLD)
+ new.sa_flags = SA_RESTART;
if (sigaction(sig, &new, &old) < 0)
return (SIG_ERR);
return (old.sa_handler);