summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-09-03 15:06:21 -0400
committerJune McEnroe <june@causal.agency>2021-09-03 15:06:21 -0400
commite7e70ffca5d1c6fa0c8e444113c6af2d78142f90 (patch)
tree700536640acf16523b107c88517714ee2304d4ef
parentBe nice and call tls_close(3) on the server (diff)
downloadpounce-e7e70ffca5d1c6fa0c8e444113c6af2d78142f90.tar.gz
pounce-e7e70ffca5d1c6fa0c8e444113c6af2d78142f90.zip
Reorder file loading in main
Diffstat (limited to '')
-rw-r--r--bounce.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/bounce.c b/bounce.c
index 416c228..b1c35c9 100644
--- a/bounce.c
+++ b/bounce.c
@@ -353,6 +353,16 @@ int main(int argc, char *argv[]) {
 		return EX_OK;
 	}
 
+	// Either exit with cleanup or ignore signals until entering the main loop.
+	signal(SIGINT, justExit);
+	signal(SIGTERM, justExit);
+	signal(SIGINFO, SIG_IGN);
+	signal(SIGUSR1, SIG_IGN);
+
+	ringAlloc(ringSize);
+	if (savePath) saveLoad(savePath);
+	serverConfig(insecure, trust, clientCert, clientPriv);
+
 #ifdef __OpenBSD__
 	unveilConfig(certPath);
 	unveilConfig(privPath);
@@ -370,15 +380,6 @@ int main(int argc, char *argv[]) {
 	if (error) err(EX_OSERR, "pledge");
 #endif
 
-	// Either exit with cleanup or ignore signals until entering the main loop.
-	signal(SIGINT, justExit);
-	signal(SIGTERM, justExit);
-	signal(SIGINFO, SIG_IGN);
-	signal(SIGUSR1, SIG_IGN);
-
-	ringAlloc(ringSize);
-	if (savePath) saveLoad(savePath);
-
 	struct Cert localCA = { -1, -1, "" };
 	if (caPath) {
 		error = 0;
@@ -422,8 +423,6 @@ int main(int argc, char *argv[]) {
 	size_t binds = bindPath[0]
 		? localUnix(bind, ARRAY_LEN(bind), bindPath)
 		: localBind(bind, ARRAY_LEN(bind), bindHost, bindPort);
-
-	serverConfig(insecure, trust, clientCert, clientPriv);
 	int server = serverConnect(serverBindHost, host, port);
 
 #ifdef __OpenBSD__