diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -572,7 +572,6 @@ { struct timespec ts = { }, *tsp = &ts; struct sigaction act = { }; - sigset_t sigset = { }; struct kevent ev; struct socklist *sl; pid_t ppid = -1, spid; @@ -813,6 +812,12 @@ exit(1); } } + + /* + * Note: When SIGCHLD is ignored, zombie processes + * are not created. + */ + act.sa_handler = SIG_IGN; for (size_t i = 0; i < nitems(sigcatch); ++i) { EV_SET(&ev, sigcatch[i], EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); if (kevent(kq, &ev, 1, NULL, 0, NULL) == -1) { @@ -820,23 +825,14 @@ pidfile_remove(pfh); exit(1); } - (void)sigaddset(&sigset, sigcatch[i]); - } - if (sigprocmask(SIG_BLOCK, &sigset, NULL) != 0) { - warn("failed to apply signal mask"); - pidfile_remove(pfh); - exit(1); + if (sigaction(sigcatch[i], &act, NULL) == -1) { + warn("failed to apply signal handler"); + pidfile_remove(pfh); + exit(1); + } } (void)alarm(TIMERINTVL); - /* Do not create zombie processes. */ - act.sa_flags = SA_NOCLDWAIT; - if (sigaction(SIGCHLD, &act, NULL) == -1) { - warn("failed to apply signal handler"); - pidfile_remove(pfh); - exit(1); - } - /* tuck my process id away */ pidfile_write(pfh);