mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
slave/spawn: restore SIGHUP handler after fork(), before exec()
Foot installs a SIG_IGN handler for SIGHUP. Ignored signals are inherited in sub-processes. Thus, we need to restore it to SIG_DFL before exec:ing.
This commit is contained in:
parent
2f7e5aed40
commit
a72b2688bd
3 changed files with 9 additions and 2 deletions
4
spawn.c
4
spawn.c
|
|
@ -44,6 +44,10 @@ spawn(struct reaper *reaper, const char *cwd, char *const argv[],
|
|||
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0)
|
||||
goto child_err;
|
||||
|
||||
/* Restore ignored (SIG_IGN) signals */
|
||||
if (sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_DFL}, NULL) < 0)
|
||||
goto child_err;
|
||||
|
||||
bool close_stderr = stderr_fd >= 0;
|
||||
bool close_stdout = stdout_fd >= 0 && stdout_fd != stderr_fd;
|
||||
bool close_stdin = stdin_fd >= 0 && stdin_fd != stdout_fd && stdin_fd != stderr_fd;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue