Make sure that SIGCHLD is not treated as a user-generated signal

in which case it could be ignored.  Bug #676
This commit is contained in:
Todd C. Miller
2014-11-04 09:24:41 -07:00
parent be2de71df4
commit 21166d4da9
2 changed files with 2 additions and 2 deletions

View File

@@ -895,7 +895,7 @@ handler(int s, siginfo_t *info, void *context)
* kill itself. For example, this can happen with some versions of * kill itself. For example, this can happen with some versions of
* reboot that call kill(-1, SIGTERM) to kill all other processes. * reboot that call kill(-1, SIGTERM) to kill all other processes.
*/ */
if (USER_SIGNALED(info)) { if (s != SIGCHLD && USER_SIGNALED(info)) {
pid_t si_pgrp = getpgid(info->si_pid); pid_t si_pgrp = getpgid(info->si_pid);
if (si_pgrp != (pid_t)-1) { if (si_pgrp != (pid_t)-1) {
if (si_pgrp == ppgrp || si_pgrp == cmnd_pid) if (si_pgrp == ppgrp || si_pgrp == cmnd_pid)

View File

@@ -147,7 +147,7 @@ mon_handler(int s, siginfo_t *info, void *context)
* itself. This can happen with, e.g., BSD-derived versions of * itself. This can happen with, e.g., BSD-derived versions of
* reboot that call kill(-1, SIGTERM) to kill all other processes. * reboot that call kill(-1, SIGTERM) to kill all other processes.
*/ */
if (USER_SIGNALED(info)) { if (s != SIGCHLD && USER_SIGNALED(info)) {
pid_t si_pgrp = getpgid(info->si_pid); pid_t si_pgrp = getpgid(info->si_pid);
if (si_pgrp != (pid_t)-1) { if (si_pgrp != (pid_t)-1) {
if (si_pgrp == cmnd_pgrp) if (si_pgrp == cmnd_pgrp)