From f8fa2e5de0348f0d2fd9c2979693dadd17268740 Mon Sep 17 00:00:00 2001 From: Quentin Armitage Date: Tue, 15 Dec 2015 12:11:09 +0000 Subject: Fix reloading and invoking notify scripts Commit 223ee0d introduced a problem with invoking notify scripts, and also responding to SIGHUP. These are now resolved. Signed-off-by: Quentin Armitage (cherry picked from commit e8dba12cc09567a930fd8bae98befb4305fa685b) --- lib/notify.c | 4 ++++ lib/signals.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/notify.c b/lib/notify.c index 7ad2d31..5251085 100644 --- a/lib/notify.c +++ b/lib/notify.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "notify.h" #include "signals.h" #include "logger.h" @@ -35,6 +36,9 @@ system_call(const char *cmdline) { int retval; + /* system() fails if SIGCHLD is set to SIG_IGN */ + signal_set(SIGCHLD, (void*)SIG_DFL, NULL); + retval = system(cmdline); if (retval == 127) { diff --git a/lib/signals.c b/lib/signals.c index e1b51aa..0e46fd9 100644 --- a/lib/signals.c +++ b/lib/signals.c @@ -92,8 +92,6 @@ signal_set(int signo, void (*func) (void *, int), void *v) struct sigaction sig; struct sigaction osig; - assert(func != NULL); - if (func == (void*)SIG_IGN || func == (void*)SIG_DFL) { sig.sa_handler = (void*)func; @@ -233,7 +231,6 @@ signal_handlers_clear(void *state) signal_set(SIGCHLD, state, NULL); signal_set(SIGUSR1, state, NULL); signal_set(SIGUSR2, state, NULL); - } void -- 1.7.12.1