summary refs log tree commit diff
path: root/service.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--service.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/service.c b/service.c
index 3178f79..78890b8 100644
--- a/service.c
+++ b/service.c
@@ -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");