X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fexec.c;h=71a49181b781ad2d9240263084b33fa6b07b0ee8;hb=dc6f54ccc87c5ae63d29f05eca91714ade689691;hp=85f6cb8038a21b12a0db63668164b3585d885577;hpb=e030096e4f5a0bbdd42635bfeb95e39d150cac72;p=collectd.git diff --git a/src/exec.c b/src/exec.c index 85f6cb80..71a49181 100644 --- a/src/exec.c +++ b/src/exec.c @@ -38,8 +38,6 @@ #include #include -#include - #define PL_NORMAL 0x01 #define PL_NOTIF_ACTION 0x02 @@ -348,7 +346,6 @@ 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 */ @@ -742,8 +739,7 @@ static void *exec_notification_one (void *arg) /* {{{ */ char errbuf[1024]; ERROR ("exec plugin: fdopen (%i) failed: %s", fd, sstrerror (errno, errbuf, sizeof (errbuf))); - kill (pl->pid, SIGTERM); - pl->pid = 0; + kill (pid, SIGTERM); close (fd); sfree (arg); pthread_exit ((void *) 1); @@ -807,10 +803,10 @@ static void *exec_notification_one (void *arg) /* {{{ */ static int exec_init (void) /* {{{ */ { - struct sigaction sa; + struct sigaction sa = { + .sa_handler = sigchld_handler + }; - memset (&sa, '\0', sizeof (sa)); - sa.sa_handler = sigchld_handler; sigaction (SIGCHLD, &sa, NULL); return (0);