[PATCH 3/3] platform: fix missing sigisemptyset
Daniel Borca
dborca at yahoo.com
Wed Nov 27 03:13:59 UTC 2013
True. Ironically, one occurence of sigisemptyset (out of two) is in
hush.c and tries to shortcircuit exactly that kind of iteration, at the
start of the loop in check_and_run_traps(). Basically, that one can be
ifdef'ed out if HAVE_SIGISEMPTYSET is undefined.
Rich Felker wrote:
>
> This is not a suitable fallback implementation. It's not needed on
> musl (we provide sigisemptyset), but if this version were used, it
> would give the wrong results, because musl's sigemptyset only fills
> the first _NSIG-1 bits and ignores the remaining ~900 bits of junk in
> sigset_t.
>
> A valid fallback for sigisemptyset would be something like:
>
> int empty = 1, i;
> for (i=1; i<_NSIG; i++) {
> if (sigismember(set, i)>0) {
> empty = 0;
> break;
> }
> }
>
> If _NSIG is unknown (not defined), sizeof(sigset_t)*8+1 could work in
> its place, assuming signals are numbered sequentially.
-dborca
More information about the busybox
mailing list