mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-30 11:10:23 -04:00
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.
This commit is contained in:
parent
197c1c5ced
commit
e67639a682
1 changed files with 5 additions and 2 deletions
7
main.c
7
main.c
|
|
@ -556,8 +556,11 @@ main(int argc, char *const *argv)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_IGN}, NULL) < 0) {
|
const struct sigaction sig_ign = {.sa_handler = SIG_IGN};
|
||||||
LOG_ERRNO("failed to ignore SIGHUP");
|
if (sigaction(SIGHUP, &sig_ign, NULL) < 0 ||
|
||||||
|
sigaction(SIGPIPE, &sig_ign, NULL) < 0)
|
||||||
|
{
|
||||||
|
LOG_ERRNO("failed to ignore SIGHUP+SIGPIPE");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue