Browse Source

set session id and init logging in -s mode. tested by david@ and matthieu@;

ok henning@
OPENBSD_4_0
otto 18 years ago
parent
commit
c01a2e9569
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      src/usr.sbin/ntpd/ntp.c

+ 7
- 1
src/usr.sbin/ntpd/ntp.c View File

@ -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> * 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); 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) if ((se = getservbyname("ntp", "udp")) == NULL)
fatal("getservbyname"); fatal("getservbyname");


Loading…
Cancel
Save