summaryrefslogtreecommitdiff
path: root/usr.sbin/hoststated/hoststated.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/hoststated/hoststated.c')
-rw-r--r--usr.sbin/hoststated/hoststated.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/hoststated/hoststated.c b/usr.sbin/hoststated/hoststated.c
index ad9e9a3f7f8..89e21ae589f 100644
--- a/usr.sbin/hoststated/hoststated.c
+++ b/usr.sbin/hoststated/hoststated.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hoststated.c,v 1.45 2007/10/19 14:15:14 pyr Exp $ */
+/* $OpenBSD: hoststated.c,v 1.46 2007/10/19 14:40:51 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -128,6 +128,8 @@ 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':
@@ -139,6 +141,7 @@ main(int argc, char *argv[])
optarg);
break;
case 'n':
+ debug = 1;
opts |= HOSTSTATED_OPT_NOACTION;
break;
case 'f':
@@ -152,8 +155,6 @@ main(int argc, char *argv[])
}
}
- log_init(debug);
-
if ((env = parse_config(conffile, opts)) == NULL)
exit(1);
hoststated_env = env;
@@ -171,6 +172,8 @@ main(int argc, char *argv[])
if (getpwnam(HOSTSTATED_USER) == NULL)
errx(1, "unknown user %s", HOSTSTATED_USER);
+ log_init(debug);
+
if (!debug) {
if (daemon(1, 0) == -1)
err(1, "failed to daemonize");