X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fexec.c;h=3d12a2de2037b83c4cc4a5e8e3b392cfb62c43ee;hb=c7e69e8e13056f062188162bb4468d33c713f897;hp=f10b816b2c9dd7d19bc6d2b35f6815f1727f2a5d;hpb=c144ae4659e129a929afb67706a54604220fef43;p=collectd.git diff --git a/src/exec.c b/src/exec.c index f10b816b..3d12a2de 100644 --- a/src/exec.c +++ b/src/exec.c @@ -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; } @@ -401,19 +401,19 @@ static int fork_child(program_list_t *pl, int *fd_in, int *fd_out, /* The group configured in the configfile is set as effective group, because * this way the forked process can (re-)gain the user's primary group. */ egid = -1; - if (NULL != pl->group) { - if ('\0' != *pl->group) { + if (pl->group != NULL) { + if (*pl->group != '\0') { struct group *gr_ptr = NULL; struct group gr; status = getgrnam_r(pl->group, &gr, nambuf, sizeof(nambuf), &gr_ptr); - if (0 != status) { + if (status != 0) { 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) { + if (gr_ptr == NULL) { ERROR("exec plugin: No such group: `%s'", pl->group); goto failed; }