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.
This commit is contained in:
Paul Kulchenko 2023-06-01 23:49:58 -07:00
parent d21ac5838c
commit da0b25500c

View file

@ -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();