Don't stop logging to stderr when running in foreground with -d.
authorreyk <reyk@openbsd.org>
Wed, 5 Jul 2017 11:11:56 +0000 (11:11 +0000)
committerreyk <reyk@openbsd.org>
Wed, 5 Jul 2017 11:11:56 +0000 (11:11 +0000)
Pointed out by Kapetanakis Giannis

usr.sbin/dhcrelay/dhcrelay.c

index 161d289..7ae9b1e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhcrelay.c,v 1.62 2017/04/04 15:50:29 reyk Exp $ */
+/*     $OpenBSD: dhcrelay.c,v 1.63 2017/07/05 11:11:56 reyk Exp $ */
 
 /*
  * Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org>
@@ -106,7 +106,6 @@ main(int argc, char *argv[])
        daemonize = 1;
 
        log_init(1, LOG_DAEMON);        /* log to stderr until daemonized */
-       log_setverbose(1);
 
        setup_iflist();
 
@@ -309,9 +308,9 @@ main(int argc, char *argv[])
        if (daemonize) {
                if (rdaemon(devnull) == -1)
                        fatal("rdaemon");
+
+               log_init(0, LOG_DAEMON);        /* stop logging to stderr */
        }
-       log_init(0, LOG_DAEMON);        /* stop loggoing to stderr */
-       log_setverbose(0);
 
        if (pledge("stdio route", NULL) == -1)
                fatalx("pledge");