about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-11-19 11:15:18 +0100
committerGitHub <noreply@github.com>2021-11-19 11:15:18 +0100
commitb18b8f553fed1c6d62f3e9348573d46348d0857c (patch)
tree7af138d9dbe56e86a9361fa7191ec53e1610328a
parent7c3d4e54eb5346995c492de289d8d8b4838f6576 (diff)
parent0c26e43486a5430158d17e3c1fc17cb00f70ad3a (diff)
downloadafl++-b18b8f553fed1c6d62f3e9348573d46348d0857c.tar.gz
Merge pull request #1168 from kcwu/restore-sigchld-handler
fork server: restore SIGCHLD handler for child process
-rw-r--r--instrumentation/afl-compiler-rt.o.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index 2bfa8b7d..1999039d 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -670,8 +670,7 @@ static void __afl_start_snapshots(void) {
 
   u8 child_stopped = 0;
 
-  signal(SIGCHLD, SIG_DFL);
-  void (*old_sigchld_handler)(int) = 0;
+  void (*old_sigchld_handler)(int) = signal(SIGCHLD, SIG_DFL);
 
   /* Phone home and tell the parent that we're OK. If parent isn't there,
      assume we're not running in forkserver mode and just execute program. */
@@ -927,8 +926,7 @@ static void __afl_start_forkserver(void) {
 
   u8 child_stopped = 0;
 
-  signal(SIGCHLD, SIG_DFL);
-  void (*old_sigchld_handler)(int) = 0;
+  void (*old_sigchld_handler)(int) = signal(SIGCHLD, SIG_DFL);
 
   if (__afl_map_size <= FS_OPT_MAX_MAPSIZE) {