summaryrefslogtreecommitdiff
path: root/asterisk.c
diff options
context:
space:
mode:
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/asterisk.c b/asterisk.c
index 21136ddb5..3563b41b2 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -2171,7 +2171,11 @@ int main(int argc, char *argv[])
ast_log(LOG_WARNING, "No such user '%s'!\n", runuser);
exit(1);
}
- if (!ast_strlen_zero(rungroup)) {
+ if (!rungroup) {
+ if (setgid(pw->pw_gid)) {
+ ast_log(LOG_WARNING, "Unable to setgid to %d!\n", pw->pw_gid);
+ exit(1);
+ }
if (initgroups(pw->pw_name, pw->pw_gid)) {
ast_log(LOG_WARNING, "Unable to init groups for '%s'\n", runuser);
exit(1);