--- syslogd.c-2.4 Thu Nov 29 13:35:34 2001 +++ syslogd.c Fri Nov 30 09:17:36 2001 @@ -841,6 +841,9 @@ #endif pid_t ppid = getpid(); #endif + struct sigaction sact; + sigset_t mask; + int ch; struct hostent *hent; @@ -1017,7 +1020,12 @@ (void) signal(SIGTERM, die); (void) signal(SIGINT, Debug ? die : SIG_IGN); (void) signal(SIGQUIT, Debug ? die : SIG_IGN); - (void) signal(SIGCHLD, reapchild); + sigemptyset(&mask); + sact.sa_handler = reapchild; + sact.sa_mask = mask; + sact.sa_flags = SA_RESTART; + (void)sigaction(SIGCHLD, &sact, NULL); + (void) signal(SIGALRM, domark); (void) signal(SIGUSR1, Debug ? debug_switch : SIG_IGN); (void) alarm(TIMERINTVL); @@ -1996,18 +2004,11 @@ void reapchild() { int saved_errno = errno; -#if defined(SYSV) && !defined(linux) - (void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */ - wait ((int *)0); -#else - union wait status; + int status; - while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0) + while (waitpid(-1, &status, WNOHANG) > 0) ; -#endif -#ifdef linux - (void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */ -#endif + errno = saved_errno; }