Public bug reported:

A program that sets the disposition of a signal to ignore (SIG_IGN) should not
be affected by the ignored signals. However, this is not the case when it calls
sigwait().
Compile and run this program file (sigwait.c):

#include <stdio.h>
#include <signal.h>
int main(int argc, char* argv[]){
    struct sigaction sa;
    sa.sa_flags = 0;
    sa.sa_handler = SIG_IGN;
    if (sigaction(SIGHUP,&sa,NULL) < 0){
        perror("sigaction error");
        return 1;
    }
    sigset_t mask;
    sigemptyset(&mask);
    sigaddset(&mask,SIGHUP);
    sigprocmask(SIG_BLOCK,&mask,NULL);
    int sig = 0;
    sigwait(&mask,&sig);
    printf("got %d\n",sig);
}

$ gcc sigwait.c
$ ./a.out

Then send it a SIGHUP signal (e.g. kill -HUP pid from another terminal).
The result is:

got 1

I.e. the program, instead of ignoring the signal, is waked up by it. 
Apparently, sigwait()
seems to handle an ignored signal as if it was not ignored.

Found in Ubuntu 9.04

** Affects: ubuntu
     Importance: Undecided
         Status: New

-- 
sigwait() resumed by ignored signal
https://bugs.launchpad.net/bugs/431813
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