How do i remove a signal handler

Dr.Knowitall picture Dr.Knowitall · Feb 15, 2012 · Viewed 9.8k times · Source

I've made the follow signal handler

struct sigaction pipeIn;
pipeIn.sa_handler = updateServer;
sigemptyset(&pipeIn.sa_mask);
sa.sa_flags = SA_RESTART;

if(sigaction(SIGUSR1, &pipeIn, NULL) == -1){

    printf("We have a problem, sigaction is not working.\n");
    perror("\n");
    exit(1);    

}

How do I remove or block this particular handler so that I can set up another signal handler that uses the same signal? Thanks.

Answer

Nikolai Fetissov picture Nikolai Fetissov · Feb 15, 2012

Use SIG_DFL in place of the function pointer when calling sigaction(2).