summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandra Kossovsky <alexandra1975@sourceforge.net>2013-04-14 11:57:56 -0700
committerMichael Richardson <mcr@sandelman.ca>2013-04-14 18:20:26 -0400
commit62e953465041494c8b3be83927267f373e9dd6ef (patch)
treea8f63ab3c23d94c88cbeeac0a645f54da14c6c84
parent578dd316f35322e88ead865af09a0d1540274cf9 (diff)
downloadtcpdump-62e953465041494c8b3be83927267f373e9dd6ef.tar.gz
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.
-rw-r--r--CREDITS1
-rw-r--r--setsignal.c2
2 files changed, 3 insertions, 0 deletions
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 <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>
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);