mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-25 05:15:41 +02:00
module/script: restore signal handlers and mask in child process
This fixes the issue where `killpg()` didn’t manage to kill the sub-process tree.
This commit is contained in:
parent
c911d20e73
commit
8702378c74
1 changed files with 14 additions and 0 deletions
|
@ -377,6 +377,20 @@ run(struct module *mod)
|
|||
if (pid == 0) {
|
||||
/* Child */
|
||||
|
||||
/* Restore signal handlers */
|
||||
|
||||
sigset_t mask;
|
||||
sigemptyset(&mask);
|
||||
|
||||
const struct sigaction sa = {.sa_handler = SIG_DFL};
|
||||
if (sigaction(SIGINT, &sa, NULL) < 0 ||
|
||||
sigaction(SIGTERM, &sa, NULL) < 0 ||
|
||||
sigaction(SIGCHLD, &sa, NULL) < 0 ||
|
||||
sigprocmask(SIG_SETMASK, &mask, NULL) < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
setpgid(0, 0);
|
||||
|
||||
/* Close pipe read ends */
|
||||
|
|
Loading…
Add table
Reference in a new issue