summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-17 18:26:09 -0400
committerJune McEnroe <june@causal.agency>2021-06-17 18:26:09 -0400
commita8c1f0297657e34b825cdce4dbe32e56c9a50984 (patch)
tree125226360e1806bd8512d1c9d0c9d8517124d005
parentAdd mailing list archive to README (diff)
downloadcatgirl-a8c1f0297657e34b825cdce4dbe32e56c9a50984.tar.gz
catgirl-a8c1f0297657e34b825cdce4dbe32e56c9a50984.zip
Clean up if restricted && logEnable, pipe creation
-rw-r--r--chat.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/chat.c b/chat.c
index 15142e6..49fc8c0 100644
--- a/chat.c
+++ b/chat.c
@@ -284,11 +284,9 @@ int main(int argc, char *argv[]) {
 	}
 
 #ifdef __OpenBSD__
-	if (self.restricted) {
-		if (logEnable) {
-			dataMkdir("");
-			unveilData("");
-		}
+	if (self.restricted && logEnable) {
+		dataMkdir("");
+		unveilData("");
 	}
 
 	char promises[64] = "stdio tty";
@@ -338,10 +336,7 @@ int main(int argc, char *argv[]) {
 	fcntl(irc, F_SETFD, FD_CLOEXEC);
 	bool pipes = !self.kiosk && !self.restricted;
 	if (pipes) {
-		int error = pipe(utilPipe);
-		if (error) err(EX_OSERR, "pipe");
-
-		error = pipe(execPipe);
+		int error = pipe(utilPipe) || pipe(execPipe);
 		if (error) err(EX_OSERR, "pipe");
 
 		fcntl(utilPipe[0], F_SETFD, FD_CLOEXEC);