mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-15 05:33:58 -04: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
6
slave.c
6
slave.c
|
|
@ -274,10 +274,12 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
|
|||
_exit(errno_copy);
|
||||
}
|
||||
|
||||
/* Restore signal mask */
|
||||
/* Restore signal mask, and SIG_IGN'd signals */
|
||||
sigset_t mask;
|
||||
sigemptyset(&mask);
|
||||
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0) {
|
||||
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0 ||
|
||||
sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_DFL}, NULL) < 0)
|
||||
{
|
||||
const int errno_copy = errno;
|
||||
LOG_ERRNO_P(errno, "failed to restore signals");
|
||||
(void)!write(fork_pipe[1], &errno_copy, sizeof(errno_copy));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue