mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-17 05:33:52 -04:00
slave: re-use ‘struct sigaction’ variable when resetting SIGHUP+SIGPIPE
This commit is contained in:
parent
fb488b6162
commit
027603cbb8
1 changed files with 4 additions and 2 deletions
6
slave.c
6
slave.c
|
|
@ -275,11 +275,13 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore signal mask, and SIG_IGN'd signals */
|
/* Restore signal mask, and SIG_IGN'd signals */
|
||||||
|
const struct sigaction dfl = {.sa_handler = SIG_DFL};
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
sigemptyset(&mask);
|
sigemptyset(&mask);
|
||||||
|
|
||||||
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0 ||
|
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0 ||
|
||||||
sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_DFL}, NULL) < 0 ||
|
sigaction(SIGHUP, &dfl, NULL) < 0 ||
|
||||||
sigaction(SIGPIPE, &(struct sigaction){.sa_handler = SIG_DFL}, NULL) < 0)
|
sigaction(SIGPIPE, &dfl, NULL) < 0)
|
||||||
{
|
{
|
||||||
const int errno_copy = errno;
|
const int errno_copy = errno;
|
||||||
LOG_ERRNO_P(errno, "failed to restore signals");
|
LOG_ERRNO_P(errno, "failed to restore signals");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue