From: Alexandra Kossovsky Date: Sun, 14 Apr 2013 18:57:56 +0000 (-0700) Subject: If we get SIGCHLD, restart whatever system call it interrupted. X-Git-Tag: tcpdump-4.5.0~94^2 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/62e953465041494c8b3be83927267f373e9dd6ef If we get SIGCHLD, restart whatever system call it interrupted. 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. --- diff --git a/CREDITS b/CREDITS index 135b1785..a1065593 100644 --- a/CREDITS +++ b/CREDITS @@ -14,6 +14,7 @@ Additional people who have contributed patches: Aaron Campbell Alfredo Andres Albert Chin + Alexandra Kossovsky Ananth Suryanarayana Andrea Bittau Andrew Brown diff --git a/setsignal.c b/setsignal.c index a4b59cef..6032835e 100644 --- a/setsignal.c +++ b/setsignal.c @@ -78,6 +78,8 @@ RETSIGTYPE 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);