diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-12-05 14:25:26 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-12-11 19:19:11 +0000 |
| commit | e67639a6822c906b65b25850cd6c00738c2db648 (patch) | |
| tree | f75c8b0f5d41616079531948de7a6fa1a249b99e | |
| parent | config: do key binding collision detection after loading the conf (diff) | |
main: ignore SIGPIPE
We want to handle SIGPIPEs without crashing... One way to trigger this
was to use e.g.
pipe-visible=[cat /foo/bar] Control+Shift+q
That is, pipe output to something that did not consume it. This led
to a SIGPIPE when we tried to write the terminal contents to the pipe,
and crashed the whole foot instance.
| -rw-r--r-- | main.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -556,8 +556,11 @@ main(int argc, char *const *argv) goto out; } - if (sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_IGN}, NULL) < 0) { - LOG_ERRNO("failed to ignore SIGHUP"); + const struct sigaction sig_ign = {.sa_handler = SIG_IGN}; + if (sigaction(SIGHUP, &sig_ign, NULL) < 0 || + sigaction(SIGPIPE, &sig_ign, NULL) < 0) + { + LOG_ERRNO("failed to ignore SIGHUP+SIGPIPE"); goto out; } |
