slave: ignore SIGHUP, instead of resetting it to DFL

This aligns foot's behavior with e.g. XTerm, when running 'foot
script.sh', where script.sh is:

    #!/usr/bin/bash

    sleep 2s
    exec setsid --fork sh -c 'sleep 5; notify-send test'

Before this patch, 'notify-send' never ran. With this patch it does.

I don't, yet, fully understand what's happening here, or what's "more"
correct.

See #1666
This commit is contained in:
Daniel Eklöf 2024-04-05 16:32:02 +02:00
parent c7848c4e75
commit 60a6991c25
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -406,8 +406,11 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
sigset_t mask; sigset_t mask;
sigemptyset(&mask); sigemptyset(&mask);
struct sigaction ign = {.sa_handler = SIG_IGN};
sigemptyset(&ign.sa_mask);
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0 || if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0 ||
sigaction(SIGHUP, &dfl, NULL) < 0 || sigaction(SIGHUP, &ign, NULL) < 0 ||
sigaction(SIGPIPE, &dfl, NULL) < 0) sigaction(SIGPIPE, &dfl, NULL) < 0)
{ {
const int errno_copy = errno; const int errno_copy = errno;