summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-06-09 07:42:09 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-06-09 07:42:09 +0000
commitea0e480bf4b4efc866472f2ee21c3c70fe43b84c (patch)
tree2391d8e475f9e5b27d8ed44729727a8e8959a4bd /usr.sbin
parente4cecb7f83b3533c9b52dcb9bef8855fb8a4ffd4 (diff)
set session id and init logging in -s mode. tested by david@ and matthieu@;
ok henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ntpd/ntp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index 72b0aaaeb0a..6f849ca17a9 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.85 2006/06/08 06:03:07 otto Exp $ */
+/* $OpenBSD: ntp.c,v 1.86 2006/06/09 07:42:08 otto Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -91,6 +91,12 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
return (pid);
}
+ /* in this case the parent didn't init logging and didn't daemonize */
+ if (nconf->settime && !nconf->debug) {
+ log_init(nconf->debug);
+ if (setsid() == -1)
+ fatal("setsid");
+ }
if ((se = getservbyname("ntp", "udp")) == NULL)
fatal("getservbyname");