summary refs log tree commit diff
path: root/chat.c
diff options
context:
space:
mode:
authorKlemens Nanni2021-06-14 13:13:23 +0000
committerC. McEnroe2021-06-14 17:15:11 -0400
commit3e0b38e48e923ea147e4ecd23dab24166e7f3ce2 (patch)
treef6c648b361a2a7cd12fa984008220f8c5d0746ce /chat.c
parent1ccadd7c72e10854f4562115d9ce783d50163afa (diff)
OpenBSD: pledge final promises earlier
No need to wait for so long.

This also brings all the pledge code on one screen and helps show how
ircConnect() is the only relevant part in between initial and final
promises.
Diffstat (limited to 'chat.c')
-rw-r--r--chat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/chat.c b/chat.c
index 09d0ca6..2a64ee0 100644
--- a/chat.c
+++ b/chat.c
@@ -315,6 +315,12 @@ int main(int argc, char *argv[]) {
 	
 	int irc = ircConnect(bind, host, port);
 
+#ifdef __OpenBSD__
+	error = pledge(promisesFinal, NULL);
+	if (error) err(EX_OSERR, "pledge");
+	free(promisesFinal);
+#endif
+
 	if (pass) ircFormat("PASS :%s\r\n", pass);
 	if (sasl) ircFormat("CAP REQ :sasl\r\n");
 	ircFormat("CAP LS\r\n");
@@ -343,12 +349,6 @@ int main(int argc, char *argv[]) {
 		fcntl(execPipe[1], F_SETFD, FD_CLOEXEC);
 	}
 
-#ifdef __OpenBSD__
-	error = pledge(promisesFinal, NULL);
-	if (error) err(EX_OSERR, "pledge");
-	free(promisesFinal);
-#endif
-
 	struct pollfd fds[] = {
 		{ .events = POLLIN, .fd = STDIN_FILENO },
 		{ .events = POLLIN, .fd = irc },