mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-13 05:33:51 -04:00
Explicitly initialize sigaction::sa_mask members with sigemptyset(3)
Not doing so before calling sigaction(3) is "undefined" according to POSIX[1]: > Applications shall call either sigemptyset() or sigfillset() at least > once for each object of type sigset_t prior to any other use of that > object. If such an object is not initialized in this way, but is > nonetheless supplied as an argument to any of pthread_sigmask(), > sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(), > sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or > sigwaitinfo(), the results are undefined. The use of designated initializers means that sa_mask members were still being initialized, but sigset_t is an opaque type and implicit initialization doesn't necessarily produce the same results as using sigemptyset(3) (although it typically does on most implementations). [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
This commit is contained in:
parent
d34c8007f1
commit
23cf80667a
6 changed files with 16 additions and 6 deletions
3
slave.c
3
slave.c
|
|
@ -275,7 +275,8 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
|
|||
}
|
||||
|
||||
/* Restore signal mask, and SIG_IGN'd signals */
|
||||
const struct sigaction dfl = {.sa_handler = SIG_DFL};
|
||||
struct sigaction dfl = {.sa_handler = SIG_DFL};
|
||||
sigemptyset(&dfl.sa_mask);
|
||||
sigset_t mask;
|
||||
sigemptyset(&mask);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue