aboutsummaryrefslogtreecommitdiff
path: root/slave.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-21 10:57:38 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-02-21 18:59:50 +0000
commitdd5c31657ee934c52f24fd77778c56468d668b45 (patch)
tree822f90cf94de20b51a36a1d0ca0a7ae8deaa9e29 /slave.c
parentMerge branch 'refactor-subsurface-creation' (diff)
spawn/slave: restore signal mask after fork
slave: no need to restore signal handlers; they are automatically restored as long as they are not SIG_IGN (which they never are in foot). spawn(): restore signal mask after fork. This fixes an issue where a terminal spawned with ctrl+shift+n did not terminate when its shell exited. Closes #366
Diffstat (limited to 'slave.c')
-rw-r--r--slave.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/slave.c b/slave.c
index 432e21ff..ed36a0b1 100644
--- a/slave.c
+++ b/slave.c
@@ -274,15 +274,10 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
_exit(_errno);
}
- /* Restore signals */
+ /* Restore signal mask */
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(SIGHUP, &sa, NULL) < 0 ||
- sigprocmask(SIG_SETMASK, &mask, NULL) < 0)
- {
+ if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0) {
const int _errno = errno;
LOG_ERRNO_P(errno, "failed to restore signals");
(void)!write(fork_pipe[1], &_errno, sizeof(_errno));