Block all signals which were registered with cleanup() as the signal handler, so we never kill processes after waitpid() returns. Also block SIGCHLD to ensure it doesn't fire between waitpid() polling and sigsuspend() waiting for a signal. Return original mask in OLD_SET. */
| 460 | waitpid() polling and sigsuspend() waiting for a signal. |
| 461 | Return original mask in OLD_SET. */ |
| 462 | static void |
| 463 | block_cleanup_and_chld (int sigterm, sigset_t *old_set) |
| 464 | { |
| 465 | sigset_t block_set; |
| 466 | sigemptyset (&block_set); |
| 467 | |
| 468 | for (int i = 0; i < countof (term_sig); i++) |
| 469 | if (sig_needs_handling (term_sig[i], sigterm)) |
| 470 | sigaddset (&block_set, term_sig[i]); |
| 471 | |
| 472 | for (int s = SIGRTMIN; s <= SIGRTMAX; s++) |
| 473 | if (sig_needs_handling (s, sigterm)) |
| 474 | sigaddset (&block_set, s); |
| 475 | |
| 476 | sigaddset (&block_set, sigterm); |
| 477 | |
| 478 | sigaddset (&block_set, SIGCHLD); |
| 479 | |
| 480 | if (sigprocmask (SIG_BLOCK, &block_set, old_set) != 0) |
| 481 | error (0, errno, _("warning: sigprocmask")); |
| 482 | } |
| 483 | |
| 484 | /* Try to disable core dumps for this process. |
| 485 | Return TRUE if successful, FALSE otherwise. */ |
no test coverage detected