diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2011-02-13 13:28:39 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2011-02-13 13:28:39 +0000 |
commit | 3616ff7a7ad8de5b2ff4ee79a91c06ef1f117043 (patch) | |
tree | 8e0e0551e1c949b61071dbb581f25573d5420067 /usr.sbin/relayd/relayd.c | |
parent | b70e32819272dfcf5649fa7a74f422679df0645e (diff) |
fix from pr 6314: allow debug logging before daemonization to help
identify configuration issues.
ok sthen@ pyr@
Diffstat (limited to 'usr.sbin/relayd/relayd.c')
-rw-r--r-- | usr.sbin/relayd/relayd.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c index 46ac4f7e4a2..7193eea5350 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.99 2010/11/30 14:38:45 reyk Exp $ */ +/* $OpenBSD: relayd.c,v 1.100 2011/02/13 13:28:38 okan Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org> @@ -138,8 +138,6 @@ main(int argc, char *argv[]) debug = 0; conffile = CONF_FILE; - log_init(1); /* log to stderr until daemonized */ - while ((c = getopt(argc, argv, "dD:nf:v")) != -1) { switch (c) { case 'd': @@ -165,6 +163,8 @@ main(int argc, char *argv[]) } } + log_init(debug ? debug : 1); /* log to stderr until daemonized */ + argc -= optind; argv += optind; if (argc > 0) @@ -187,9 +187,8 @@ main(int argc, char *argv[]) if (getpwnam(RELAYD_USER) == NULL) errx(1, "unknown user %s", RELAYD_USER); - log_init(debug); - if (!debug) { + log_init(debug); if (daemon(1, 0) == -1) err(1, "failed to daemonize"); } |