mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-11 04:27:49 -05: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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue