I have a problem with my code C Unix. I'll copy crucial parts: So after the first sigprocmask I send a signal, after the SIG_UNBLOCK, doesn't work the previous handle(gestisciSignalDopoReg) instead the standard handle manage my signal, so it simply terminate the process... What's wrong? Thanks
struct sigaction gestoreSegnale;
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask,SIGTERM);
sigaddset(&mask,SIGINT);
sigaddset(&mask,SIGALRM);
sigaddset(&mask,SIGQUIT);
sigaddset(&mask,SIGHUP);
sigaddset(&mask,SIGSEGV);
sigaddset(&mask,SIGILL);
sigaddset(&mask,SIGPIPE);
void setSegnali(int segn,__sighandler_t handler){
gestoreSegnale.sa_handler=handler;
gestoreSegnale.sa_mask=mask;
sigaction(segn, &gestoreSegnale, NULL);
}
void eseguiSetSegnali(__sighandler_t handler){
setSegnali(SIGQUIT, handler);
setSegnali(SIGSEGV, handler);
setSegnali(SIGILL, handler);
setSegnali(SIGHUP, handler);
setSegnali(SIGTERM, handler);
setSegnali(SIGINT, handler);
}
void main(){
eseguiSetSegnali(gestisciSIGNALDopoReg);
sigprocmask(SIG_BLOCK,&mask,NULL);
.........other part of code.........
sigprocmask(SIG_UNBLOCK,&mask,NULL);
}
please! I need help!