fix sigemptyset and sigfillset for mips
authorRich Felker <dalias@aerifal.cx>
Mon, 16 Sep 2013 16:58:51 +0000 (12:58 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 16 Sep 2013 16:58:51 +0000 (12:58 -0400)
they were leaving junk in the upper bits.

src/signal/sigemptyset.c
src/signal/sigfillset.c

index ca9b89207f97bb59f6c6b754a6bb2ebbe50b5f01..1d07471da45717f92c4b7ca25b8fa4edda416828 100644 (file)
@@ -4,6 +4,10 @@
 int sigemptyset(sigset_t *set)
 {
        set->__bits[0] = 0;
-       if (sizeof(long)==4) set->__bits[1] = 0;
+       if (sizeof(long)==4 || _NSIG > 65) set->__bits[1] = 0;
+       if (sizeof(long)==4 && _NSIG > 65) {
+               set->__bits[2] = 0;
+               set->__bits[3] = 0;
+       }
        return 0;
 }
index 6c84b9b7859b03472fe91e8ad5575f45afa54c1d..4d0a807a97f02bb1e669f2110d222b55f1eb8dbd 100644 (file)
@@ -7,8 +7,13 @@ int sigfillset(sigset_t *set)
 #if ULONG_MAX == 0xffffffff
        set->__bits[0] = 0x7ffffffful;
        set->__bits[1] = 0xfffffffcul;
+       if (_NSIG > 65) {
+               set->__bits[2] = 0xfffffffful;
+               set->__bits[3] = 0xfffffffful;
+       }
 #else
        set->__bits[0] = 0xfffffffc7ffffffful;
+       if (_NSIG > 65) set->__bits[1] = 0xfffffffffffffffful;
 #endif
        return 0;
 }