From 5d0e3b0c9dc6cd4ac5fe4837947a68cb81d94244 Mon Sep 17 00:00:00 2001 From: Quentin Armitage Date: Wed, 9 Dec 2015 15:18:17 +0000 Subject: Set standard signal disposition before invoking ip(6)tables Call signal_handler_notify before running iptables/ip6tables. Since it is now called for more than notify scripts, rename signal_handler_notify to signal_handler_script Signed-off-by: Quentin Armitage (cherry picked from commit 44f9b15fec849ffa15cda37cc4fe099b64142599) --- lib/notify.c | 4 ++-- lib/signals.c | 4 ++-- lib/signals.h | 2 +- lib/utils.c | 4 ++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/notify.c b/lib/notify.c index 0908f89..7ad2d31 100644 --- a/lib/notify.c +++ b/lib/notify.c @@ -76,7 +76,7 @@ notify_exec(char *cmd) if (pid) return 0; - signal_handler_notify(); + signal_handler_script(); closeall(0); open("/dev/null", O_RDWR); @@ -118,7 +118,7 @@ system_call_script(thread_master_t *m, int (*func) (thread_t *), void * arg, lon } /* Child part */ - signal_handler_notify(); + signal_handler_script(); closeall(0); open("/dev/null", O_RDWR); ret = dup(0); diff --git a/lib/signals.c b/lib/signals.c index 68751ba..e1b51aa 100644 --- a/lib/signals.c +++ b/lib/signals.c @@ -252,10 +252,10 @@ signal_handler_destroy(void) signal_pipe[0] = -1; } -/* Called prior to exec'ing a notify script. The script can reasonably +/* Called prior to exec'ing a script. The script can reasonably * expect to have the standard signal disposition */ void -signal_handler_notify(void) +signal_handler_script(void) { struct sigaction ign, dfl; int sig; diff --git a/lib/signals.h b/lib/signals.h index 1a3f91d..15870be 100644 --- a/lib/signals.h +++ b/lib/signals.h @@ -31,7 +31,7 @@ extern void *signal_ignore(int signo); extern void signal_handler_init(void); extern void signal_handler_destroy(void); extern void signal_handler_reset(void); -extern void signal_handler_notify(void); +extern void signal_handler_script(void); extern void signal_run_callback(void); extern int signal_rfd(void); diff --git a/lib/utils.c b/lib/utils.c index e4caa77..367bdfe 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -25,6 +25,7 @@ #include #include #include "utils.h" +#include "signals.h" /* global vars */ unsigned long debug = 0; @@ -510,6 +511,9 @@ fork_exec(char **argv) if (fd > 2) close(fd); } + + signal_handler_script(); + execvp(*argv, argv); exit(EXIT_FAILURE); } else { -- 1.7.12.1