projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7077de7
)
fixed build issues
author
smallem
<sridhar.mallem@oracle.com>
Fri, 5 Oct 2018 04:12:49 +0000
(
00:12
-0400)
committer
smallem
<sridhar.mallem@oracle.com>
Fri, 5 Oct 2018 04:12:49 +0000
(
00:12
-0400)
src/exec.c
patch
|
blob
|
history
diff --git
a/src/exec.c
b/src/exec.c
index
b005dda
..
e5c5df9
100644
(file)
--- 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.
*/
/*
* 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') {
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) {
DEBUG("exec plugin: release grbuf memory ");
grbuf = NULL;
if (getgr_failed > 0) {
- goto failed;
+ egid = -2; // arbitrary value to indicate fail
}
} else {
egid = gid;
}
} 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. */
/* 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) {
pid = fork();
if (pid < 0) {