From e7e70ffca5d1c6fa0c8e444113c6af2d78142f90 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 3 Sep 2021 15:06:21 -0400 Subject: Reorder file loading in main --- bounce.c | 21 ++++++++++----------- 1 file 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__ -- cgit 1.4.1