From: Florian Forster Date: Tue, 15 Sep 2009 13:40:47 +0000 (+0200) Subject: exec plugin: Clear the signal block mask before calling exec(2). X-Git-Tag: collectd-4.7.4~20 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f6f13c914fe9ec2849dd360d96ff44571b37ab81;p=collectd.git exec plugin: Clear the signal block mask before calling exec(2). --- diff --git a/src/exec.c b/src/exec.c index 1f8a9ac0..8719201e 100644 --- a/src/exec.c +++ b/src/exec.c @@ -382,6 +382,15 @@ static void exec_child (program_list_t *pl) /* {{{ */ exit (-1); } /* void exec_child }}} */ +static void reset_signal_mask (void) /* {{{ */ +{ + sigset_t ss; + + memset (&ss, 0, sizeof (ss)); + sigemptyset (&ss); + sigprocmask (SIG_SETMASK, &ss, /* old mask = */ NULL); +} /* }}} void reset_signal_mask */ + /* * Creates three pipes (one for reading, one for writing and one for errors), * forks a child, sets up the pipes so that fd_in is connected to STDIN of @@ -468,6 +477,9 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err) close (fd_pipe_err[1]); } + /* Unblock all signals */ + reset_signal_mask (); + exec_child (pl); /* does not return */ }