aboutgitcodebugslistschat
path: root/passt.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-11-08 09:08:57 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-11-10 11:17:50 +0100
commit6533a4a07bb684ad778fca329ad90ecc4797336a (patch)
treecb55bab8f25fe88e847101f5bfa642e554e913df /passt.c
parent198f87835dc448c7561e2d8ba0ece24e63bc9447 (diff)
downloadpasst-6533a4a07bb684ad778fca329ad90ecc4797336a.tar
passt-6533a4a07bb684ad778fca329ad90ecc4797336a.tar.gz
passt-6533a4a07bb684ad778fca329ad90ecc4797336a.tar.bz2
passt-6533a4a07bb684ad778fca329ad90ecc4797336a.tar.lz
passt-6533a4a07bb684ad778fca329ad90ecc4797336a.tar.xz
passt-6533a4a07bb684ad778fca329ad90ecc4797336a.tar.zst
passt-6533a4a07bb684ad778fca329ad90ecc4797336a.zip
passt: Move __setlogmask() calls before output unrelated to configuration
...so that we avoid printing some lines twice because log-level is still set to LOG_EMERG, as if logging configuration didn't happen yet. While at it, note that logging to stderr doesn't really depend on whether debug mode is enabled or not. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.c')
-rw-r--r--passt.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/passt.c b/passt.c
index fd703de..7d323c2 100644
--- a/passt.c
+++ b/passt.c
@@ -243,9 +243,16 @@ int main(int argc, char **argv)
conf(&c, argc, argv);
trace_init(c.trace);
- if (!c.debug && (c.stderr || isatty(fileno(stdout))))
+ if (c.stderr || isatty(fileno(stdout)))
__openlog(log_name, LOG_PERROR, LOG_DAEMON);
+ if (c.debug)
+ __setlogmask(LOG_UPTO(LOG_DEBUG));
+ else if (c.quiet)
+ __setlogmask(LOG_UPTO(LOG_ERR));
+ else
+ __setlogmask(LOG_UPTO(LOG_INFO));
+
quit_fd = pasta_netns_quit_init(&c);
c.fd_tap = c.fd_tap_listen = -1;
@@ -267,13 +274,6 @@ int main(int argc, char **argv)
if (c.ifi6 && !c.no_dhcpv6)
dhcpv6_init(&c);
- if (c.debug)
- __setlogmask(LOG_UPTO(LOG_DEBUG));
- else if (c.quiet)
- __setlogmask(LOG_UPTO(LOG_ERR));
- else
- __setlogmask(LOG_UPTO(LOG_INFO));
-
pcap_init(&c);
if (!c.foreground) {