diff options
author | 2006-06-09 07:42:08 +0000 | |
---|---|---|
committer | 2006-06-09 07:42:08 +0000 | |
commit | 4f98a7ee59745a1158a77a7ed9626f469d623c7c (patch) | |
tree | 8018508f8d7d987f8c80190631cb5cd2ebebb478 | |
parent | {x,}ldcontrolb() codepath is SUN4-only, so don't bother checking for Lfsbail (diff) | |
download | wireguard-openbsd-4f98a7ee59745a1158a77a7ed9626f469d623c7c.tar.xz wireguard-openbsd-4f98a7ee59745a1158a77a7ed9626f469d623c7c.zip |
set session id and init logging in -s mode. tested by david@ and matthieu@;
ok henning@
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 8 |
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"); |