X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fexec.c;h=70b5fd0400cfb133fbf51d66039ebfbbbd4de36b;hb=f66916deea905254061bb07245e007471faf2ecf;hp=c51465b810064162517a4e3f53bae9107a7a5b19;hpb=e5e5d99350fa54e22f07b90fbc3102df51565ad9;p=collectd.git diff --git a/src/exec.c b/src/exec.c index c51465b8..70b5fd04 100644 --- a/src/exec.c +++ b/src/exec.c @@ -274,7 +274,7 @@ static void set_environment (void) /* {{{ */ CDTIME_T_TO_DOUBLE (plugin_get_interval ())); setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1); - ssnprintf (buffer, sizeof (buffer), "%s", hostname_g); + sstrncpy (buffer, hostname_g, sizeof (buffer)); setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1); #else ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%.3f", @@ -547,7 +547,7 @@ failed: static int parse_line (char *buffer) /* {{{ */ { if (strncasecmp ("PUTVAL", buffer, strlen ("PUTVAL")) == 0) - return (handle_putval (stdout, buffer)); + return (cmd_handle_putval (stdout, buffer)); else if (strncasecmp ("PUTNOTIF", buffer, strlen ("PUTNOTIF")) == 0) return (handle_putnotif (stdout, buffer)); else @@ -810,14 +810,14 @@ static int exec_init (void) /* {{{ */ sigaction (SIGCHLD, &sa, NULL); -#ifdef HAVE_SYS_CAPABILITY_H +#if defined(HAVE_SYS_CAPABILITY_H) && defined(CAP_SETUID) && defined(CAP_SETGID) if ((check_capability (CAP_SETUID) != 0) || (check_capability (CAP_SETGID) != 0)) { if (getuid () == 0) WARNING ("exec plugin: Running collectd as root, but the CAP_SETUID " "or CAP_SETGID capabilities are missing. The plugin's read function " - "will probably fail. Is your init system dropping capabilities ?"); + "will probably fail. Is your init system dropping capabilities?"); else WARNING ("exec plugin: collectd doesn't have the CAP_SETUID or " "CAP_SETGID capabilities. If you don't want to run collectd as root, " @@ -852,7 +852,7 @@ static int exec_read (void) /* {{{ */ pthread_attr_init (&attr); pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - plugin_thread_create (&t, &attr, exec_read_one, (void *) pl); + plugin_thread_create (&t, &attr, exec_read_one, (void *) pl, "exec read"); pthread_attr_destroy (&attr); } /* for (pl) */ @@ -894,7 +894,8 @@ static int exec_notification (const notification_t *n, /* {{{ */ pthread_attr_init (&attr); pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - plugin_thread_create (&t, &attr, exec_notification_one, (void *) pln); + plugin_thread_create (&t, &attr, exec_notification_one, (void *) pln, + "exec notify"); pthread_attr_destroy (&attr); } /* for (pl) */