Public bug reported:

Compile and run the following program file (sigpending.c):

#include <signal.h>
#include <stdio.h>
int main(int argc, char* argv[]){
    sigset_t sigpend;
    sigpending(&sigpend);
    printf("empty? %d\n",sigisemptyset(&sigpend));
    int i;
    for (i = 1; i < SIGRTMAX; i++){
        printf("i: %d %d\n",i,sigismember(&sigpend,i));
    }
}

$ gcc sigpending.c
$ ./a.out
empty? 0
i: 1 0
i: 2 0
i: 3 0
.....

Whe the program is run, no singals are pending, and sigpending() should then 
deliver
an empty signal set. This is confirmed by the for loop in which the presence in 
the
set of all signals is displayed. However, sigismember() returns 0, telling that 
the set
is NOT empty. Effectively, if the whole sigpend array is displayed, some bytes 
beyond
the ones dedicated to the supported signals are not 0. There is then a problem 
either
in sigsuspend(), which does not properly clear the array before marking in it 
the
pending signals, or in sigismember(), that tests more bytes than needed. This 
forces
to call sigemptyset(&sigpend) before ANY calls to sigpending() that are 
followed by
sigismember() to get consistent results.

Ubuntu 9.04

** Affects: glibc (Ubuntu)
     Importance: Undecided
         Status: New

-- 
sigisemptyset() does not detect empty set
https://bugs.launchpad.net/bugs/432750
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to