aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-21 18:22:24 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-21 18:22:24 +0000
commitc605503df6b5f265e65b5017870417401d969555 (patch)
treeca0019b455cf2dd44adc3704bc80091eb36e2d8a
parentterm: don't double fork new terminal windows (diff)
slave: restore signal mask
-rw-r--r--CHANGELOG.md1
-rw-r--r--slave.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 822b5527..86702235 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,7 @@
* Rare crash when scrolling and the new viewport ended up **exactly**
on the wrap around.
* Selection handling when viewport wrapped around.
+* Restore signal mask in the slave process.
### Security
diff --git a/slave.c b/slave.c
index 57bedc75..26ccdf6f 100644
--- a/slave.c
+++ b/slave.c
@@ -166,10 +166,13 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
}
/* Restore signals */
+ 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)
+ sigaction(SIGHUP, &sa, NULL) < 0 ||
+ sigprocmask(SIG_SETMASK, &mask, NULL) < 0)
{
const int _errno = errno;
LOG_ERRNO_P("failed to restore signals", errno);