summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-16 22:20:14 -0400
committerJune McEnroe <june@causal.agency>2020-08-16 22:20:14 -0400
commitf9cfab1e0d1183eb5e948b6dabc6017b9e261704 (patch)
treefefa6f0f61959104ea47325ec2eede791d2c0cd8
parentDon't set LOGNAME (diff)
downloadcatsit-f9cfab1e0d1183eb5e948b6dabc6017b9e261704.tar.gz
catsit-f9cfab1e0d1183eb5e948b6dabc6017b9e261704.zip
Only call setgroups as root
setgroups fails when already running as a user.
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");
020-02-11 17:41:06 -0500'>2020-02-11Move hash to top of chat.hJune McEnroe 2020-02-11Move base64 out of chat.hJune McEnroe 2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe 2020-02-11Fix whois idle unit calculationJune McEnroe Rookie mistake. 2020-02-11Cast towupper to wchar_tJune McEnroe For some reason it takes and returns wint_t... 2020-02-11Cast set but unused variables to voidJune McEnroe 2020-02-11Declare strlcatJune McEnroe 2020-02-11Check if VDSUSP existsJune McEnroe 2020-02-11Fix completeReplace iterationJune McEnroe 2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe 2020-02-11Remove legacy codeJune McEnroe 2020-02-11Add INSTALLING section to READMEJune McEnroesrc/commit/home/.config/X/resources?id=11db1d928fcd0fe72d9bc70a7a3a2f9d5ecc1685&follow=1'>Set urgency on bell in xtermJune McEnroe 2021-02-07Add bindings for brightness controlJune McEnroe 2021-02-07Set X key repeat rateJune McEnroe 2021-02-07Bump font size to 12June McEnroe 2021-02-07Fully configure and rebind cwmJune McEnroe 2021-02-07Add BintiJune McEnroe 2021-02-07Finish configuring xtermJune McEnroe 2021-02-06Enable tapping, reverse scroll, set scaling in wsconsctlJune McEnroe 2021-02-06Set root window to black on purple snowJune McEnroe 2021-02-06Add xmodmap configurationJune McEnroe 2021-02-06Add initial OpenBSD X configurationJune McEnroe 2021-02-06Add xterm output to schemeJune McEnroe