conf: set the log level much earlier
--quiet is supposed to silence the "No routable interface" message but it does not work because the log level was set long after conf_ip4/6() was called which means it uses the default level which logs everything. To address this move the log level logic directly after the option parsing in conf(). Signed-off-by: Paul Holzinger <pholzing@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
b08716551a
commit
15001b39ef
2 changed files with 10 additions and 10 deletions
10
conf.c
10
conf.c
|
@ -1646,6 +1646,16 @@ void conf(struct ctx *c, int argc, char **argv)
|
|||
logfile, logsize);
|
||||
}
|
||||
|
||||
/* Once the log mask is not LOG_EARLY, we will no longer log to stderr
|
||||
* if there was a log file specified.
|
||||
*/
|
||||
if (c->debug)
|
||||
__setlogmask(LOG_UPTO(LOG_DEBUG));
|
||||
else if (c->quiet)
|
||||
__setlogmask(LOG_UPTO(LOG_WARNING));
|
||||
else
|
||||
__setlogmask(LOG_UPTO(LOG_INFO));
|
||||
|
||||
nl_sock_init(c, false);
|
||||
if (!v6_only)
|
||||
c->ifi4 = conf_ip4(ifi4, &c->ip4, c->mac);
|
||||
|
|
10
passt.c
10
passt.c
|
@ -320,16 +320,6 @@ int main(int argc, char **argv)
|
|||
if (isolate_prefork(&c))
|
||||
die("Failed to sandbox process, exiting");
|
||||
|
||||
/* Once the log mask is not LOG_EARLY, we will no longer log to stderr
|
||||
* if there was a log file specified.
|
||||
*/
|
||||
if (c.debug)
|
||||
__setlogmask(LOG_UPTO(LOG_DEBUG));
|
||||
else if (c.quiet)
|
||||
__setlogmask(LOG_UPTO(LOG_WARNING));
|
||||
else
|
||||
__setlogmask(LOG_UPTO(LOG_INFO));
|
||||
|
||||
if (!c.foreground)
|
||||
__daemon(pidfile_fd, devnull_fd);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue