From: Rich Felker Date: Sat, 1 Sep 2018 18:14:32 +0000 (-0400) Subject: consistently use _NSIG/8 idiom for kernel sigset size in sigaction X-Git-Tag: v1.1.20~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d0d212525ec7d08a4770fba97aa913ea34cafdb2;p=oweals%2Fmusl.git consistently use _NSIG/8 idiom for kernel sigset size in sigaction this code in sigaction was the only place where sizeof was being applied to the kernel sigaction's mask member to get the size argument to pass to the kernel. everywhere else, _NSIG/8 is used for this purpose. --- diff --git a/src/signal/sigaction.c b/src/signal/sigaction.c index 79989500..ac9a3ac2 100644 --- a/src/signal/sigaction.c +++ b/src/signal/sigaction.c @@ -53,9 +53,9 @@ int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigact ksa.handler = sa->sa_handler; ksa.flags = sa->sa_flags | SA_RESTORER; ksa.restorer = (sa->sa_flags & SA_SIGINFO) ? __restore_rt : __restore; - memcpy(&ksa.mask, &sa->sa_mask, sizeof ksa.mask); + memcpy(&ksa.mask, &sa->sa_mask, _NSIG/8); } - int r = __syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa_old:0, sizeof ksa.mask); + int r = __syscall(SYS_rt_sigaction, sig, sa?&ksa:0, old?&ksa_old:0, _NSIG/8); if (sig == SIGABRT && sa && sa->sa_handler != SIG_DFL) { UNLOCK(__abort_lock); __restore_sigs(&set); @@ -63,7 +63,7 @@ int __libc_sigaction(int sig, const struct sigaction *restrict sa, struct sigact if (old && !r) { old->sa_handler = ksa_old.handler; old->sa_flags = ksa_old.flags; - memcpy(&old->sa_mask, &ksa_old.mask, sizeof ksa_old.mask); + memcpy(&old->sa_mask, &ksa_old.mask, _NSIG/8); } return __syscall_ret(r); }