From da0b25500c9291e60c718f3c917f310ca5389f80 Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Thu, 1 Jun 2023 23:49:58 -0700 Subject: [PATCH] Move GetHostIps before processing command line options This allows using unix.pledge as part of the options without affecting retrieving host IP addresses (which requires `connect`). It may still fail under external `pledge` command as expected; in this case IPs would need to be passed manually. --- tool/net/redbean.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/net/redbean.c b/tool/net/redbean.c index 2affc80e2..23aab74f6 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -7401,12 +7401,12 @@ void RedBean(int argc, char *argv[]) { CHECK_NE(-1, fstat(zfd, &zst)); OpenZip(true); SetDefaults(); - LuaStart(); - GetOpts(argc, argv); // this can fail with EPERM if we're running under pledge() if (!interpretermode && !(interfaces = GetHostIps())) { WARNF("(srvr) failed to query system network interface addresses: %m"); } + LuaStart(); + GetOpts(argc, argv); #ifndef STATIC if (selfmodifiable) { MakeExecutableModifiable();