Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/syslogd We have to read the config file the first t...



details:   https://anonhg.NetBSD.org/src/rev/399e52761deb
branches:  trunk
changeset: 571341:399e52761deb
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Nov 19 02:51:18 2004 +0000

description:
We have to read the config file the first time after we allocate the
kqueue descriptor, because we set up events after we parse the file.

Unfortuntately, this means that we also have to do the chroot before
we read the config file.  But this is OK -- the config file has to be
in the chroot environment anyway, because it has to be able to get to
it after SIGHUP.

Grrr, all because stupid kqueue descriptors are not inherited across
a fork.  LAME.

diffstat:

 usr.sbin/syslogd/syslogd.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 7a2512dc9f05 -r 399e52761deb usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c        Fri Nov 19 02:19:58 2004 +0000
+++ b/usr.sbin/syslogd/syslogd.c        Fri Nov 19 02:51:18 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syslogd.c,v 1.70 2004/11/19 02:18:11 thorpej Exp $     */
+/*     $NetBSD: syslogd.c,v 1.71 2004/11/19 02:51:18 thorpej Exp $     */
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)syslogd.c  8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.70 2004/11/19 02:18:11 thorpej Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.71 2004/11/19 02:51:18 thorpej Exp $");
 #endif
 #endif /* not lint */
 
@@ -467,8 +467,6 @@
                dprintf("Listening on unix dgram socket `%s'\n", *pp);
        }
 
-       init(NULL);
-
        if ((fklog = open(_PATH_KLOG, O_RDONLY, 0)) < 0) {
                dprintf("Can't open `%s' (%d)\n", _PATH_KLOG, errno);
        } else {
@@ -521,6 +519,13 @@
        }
 
        /*
+        * We must read the configuration file for the first time
+        * after the kqueue descriptor is created, because we install
+        * events during this process.
+        */
+       init(NULL);
+
+       /*
         * Always exit on SIGTERM.  Also exit on SIGINT and SIGQUIT
         * if we're debugging.
         */



Home | Main Index | Thread Index | Old Index