Merge branch 'collectd-4.8'
[collectd.git] / src / exec.c
index bbd23df..acc6cf6 100644 (file)
@@ -393,6 +393,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
@@ -480,6 +489,10 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
     }
 
     set_environment ();
+
+    /* Unblock all signals */
+    reset_signal_mask ();
+
     exec_child (pl);
     /* does not return */
   }
@@ -742,7 +755,8 @@ static void *exec_notification_one (void *arg) /* {{{ */
   DEBUG ("exec plugin: Child %i exited with status %i.",
       pid, status);
 
-  plugin_notification_meta_free (n->meta);
+  if (n->meta != NULL)
+    plugin_notification_meta_free (n->meta);
   n->meta = NULL;
   sfree (arg);
   pthread_exit ((void *) 0);