Only call setgroups as root
setgroups fails when already running as a user.
This commit is contained in:
parent
daac7db044
commit
f9cfab1e0d
@ -187,8 +187,10 @@ void serviceStart(struct Service *service) {
|
||||
error = setgid(serviceGID);
|
||||
if (error) err(ExitNoExec, "setgid");
|
||||
|
||||
error = setgroups(1, &serviceGID);
|
||||
if (error) err(ExitNoExec, "setgroups");
|
||||
if (!getuid()) {
|
||||
error = setgroups(1, &serviceGID);
|
||||
if (error) err(ExitNoExec, "setgroups");
|
||||
}
|
||||
|
||||
error = setuid(serviceUID);
|
||||
if (error) err(ExitNoExec, "setuid");
|
||||
|
Loading…
Reference in New Issue
Block a user