Changed signal() to sigaction()
This commit is contained in:
14
signal.c
14
signal.c
@@ -16,8 +16,18 @@ int stopped()
|
||||
|
||||
void set_intr()
|
||||
{
|
||||
signal(SIGINT, stopall);
|
||||
struct sigaction sig;
|
||||
|
||||
sig.sa_handler = stopall;
|
||||
sigemptyset(&sig.sa_mask);
|
||||
//sigaddset(&new.sa_mask, SIGINT);
|
||||
//sigaddset(&new.sa_mask, SIGALRM);
|
||||
sig.sa_flags = 0;
|
||||
//sigaction(SIGINT, NULL, &old);
|
||||
//if (old_action.sa_handler != SIG_IGN) {
|
||||
sigaction(SIGINT, &sig, NULL);
|
||||
sigaction(SIGALRM, &sig, NULL);
|
||||
# ifdef DEBUG
|
||||
printf("SIGINT armed.\n");
|
||||
printf("SIGINT and SIGALRM armed.\n");
|
||||
# endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user