return (0);
} /* int exec_config }}} */
+static void set_environment (void) /* {{{ */
+{
+ char buffer[1024];
+
+ ssnprintf (buffer, sizeof (buffer), "%i", interval_g);
+ setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
+
+ ssnprintf (buffer, sizeof (buffer), "%s", hostname_g);
+ setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
+} /* }}} void set_environment */
+
static void exec_child (program_list_t *pl) /* {{{ */
{
int status;
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
close (fd_pipe_err[1]);
}
+ set_environment ();
+
+ /* Unblock all signals */
+ reset_signal_mask ();
+
exec_child (pl);
/* does not return */
}
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);