syslogd: terminated during startup

From: Jon Burgess (Jon_Burgess@eur.3com.com)
Date: Thu Sep 06 2001 - 12:31:56 CEST


Sometimes when I start syslogd I received an error saying that it was
terminated. I believe the child is seinding the SIGTERM signal to the parent
before it has installed the signal handler, in syslogd.c the parent signal
handler is not installed until after the child is forked so there is a window of
opportunity for the child to send the signal before the handler is installed. My
setup is a little odd, I am running sysklogd-1.4.1 under 'user mode linux' with
a fairly minimal root filesystem so this might be doing something odd to the
timing and scheduling of the processes.

The patch below is against sysklogd-1.4.1 and fixes the problem for me by
installing the handler before the fork but I can't be sure it doesn't cause some
other problems. Does this look OK to you?

     Jon Burgess

--- syslogd.c~ Sun Mar 11 19:40:10 2001
+++ syslogd.c Thu Sep 6 11:16:37 2001
@@ -890,11 +890,11 @@
          dprintf("Checking pidfile.\n");
          if (!check_pid(PidFile))
          {
+ signal (SIGTERM, doexit);
               if (fork()) {
                    /*
                     * Parent process
                     */
- signal (SIGTERM, doexit);
                    sleep(300);
                    /*
                     * Not reached unless something major went wrong. 5



This archive was generated by hypermail 2.1.2 : Thu Sep 06 2001 - 12:30:19 CEST