X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fexec.c;h=28380ac33677788acd1ffc2b4058ba08a9661e53;hb=96b920e6b7bf70560eb95c911202afbeaab2b965;hp=c84c1c7b63463440dd99aa71dd78f26c9c8a2b1a;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f;p=collectd.git diff --git a/src/exec.c b/src/exec.c index c84c1c7b..28380ac3 100644 --- a/src/exec.c +++ b/src/exec.c @@ -250,7 +250,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", @@ -369,7 +369,7 @@ static int fork_child(program_list_t *pl, int *fd_in, int *fd_out, struct passwd *sp_ptr; struct passwd sp; - char nambuf[2048]; + char nambuf[4096]; if (pl->pid != 0) return (-1); @@ -382,7 +382,7 @@ static int fork_child(program_list_t *pl, int *fd_in, int *fd_out, status = getpwnam_r(pl->user, &sp, nambuf, sizeof(nambuf), &sp_ptr); if (status != 0) { ERROR("exec plugin: Failed to get user information for user ``%s'': %s", - pl->user, sstrerror(errno, errbuf, sizeof(errbuf))); + pl->user, sstrerror(status, errbuf, sizeof(errbuf))); goto failed; } @@ -410,7 +410,7 @@ static int fork_child(program_list_t *pl, int *fd_in, int *fd_out, if (0 != status) { ERROR("exec plugin: Failed to get group information " "for group ``%s'': %s", - pl->group, sstrerror(errno, errbuf, sizeof(errbuf))); + pl->group, sstrerror(status, errbuf, sizeof(errbuf))); goto failed; } if (NULL == gr_ptr) { @@ -500,7 +500,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 { @@ -787,7 +787,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) */ @@ -826,7 +826,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) */