From: Florian Forster Date: Fri, 31 Aug 2007 09:52:31 +0000 (+0200) Subject: exec plugin: Call `setgid' first so argitary groups can be configured. X-Git-Tag: collectd-4.1.1~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ecb57478f71feee806c0577f05436b9a96d908b5;p=collectd.git exec plugin: Call `setgid' first so argitary groups can be configured. --- diff --git a/src/exec.c b/src/exec.c index e416c8f0..e899a1c3 100644 --- a/src/exec.c +++ b/src/exec.c @@ -146,14 +146,6 @@ static void exec_child (program_list_t *pl) exit (-1); } - status = setuid (uid); - if (status != 0) - { - ERROR ("exec plugin: setuid failed: %s", - sstrerror (errno, errbuf, sizeof (errbuf))); - exit (-1); - } - if (NULL != pl->group) { if ('\0' != *pl->group) { @@ -187,6 +179,14 @@ static void exec_child (program_list_t *pl) sstrerror (errno, errbuf, sizeof (errbuf))); exit (-1); } + } /* if (pl->group == NULL) */ + + status = setuid (uid); + if (status != 0) + { + ERROR ("exec plugin: setuid failed: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + exit (-1); } arg0 = strrchr (pl->exec, '/');