From 2b95935417aa46534bf986c06a8723e0af32d63f Mon Sep 17 00:00:00 2001 From: smallem Date: Fri, 5 Oct 2018 00:12:49 -0400 Subject: [PATCH] fixed build issues --- src/exec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/exec.c b/src/exec.c index b005dda7..e5c5df9f 100644 --- a/src/exec.c +++ b/src/exec.c @@ -348,7 +348,8 @@ static void close_pipe(int fd_pipe[2]) /* {{{ */ /* * Get effective group ID from group name. */ -static int getegid(program_list_t *pl) { +static int getegr_id(program_list_t *pl, int gid) /* {{{ */ +{ int egid = -1; if (pl->group != NULL) { if (*pl->group != '\0') { @@ -417,7 +418,7 @@ static int getegid(program_list_t *pl) { DEBUG("exec plugin: release grbuf memory "); grbuf = NULL; if (getgr_failed > 0) { - goto failed; + egid = -2; // arbitrary value to indicate fail } } else { egid = gid; @@ -484,7 +485,11 @@ 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 = getegid(pl); + egid = getegr_id(pl, gid); + if (egid <= -2) { + ERROR("exec plugin: getegr_id failed: %s", STRERRNO); + goto failed; + } pid = fork(); if (pid < 0) { -- 2.11.0