Changed signal() to sigaction()

This commit is contained in:
2021-01-27 12:16:34 +01:00
parent 157c64bd6e
commit fb297756b6

View File

@@ -16,8 +16,18 @@ int stopped()
void set_intr() 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 # ifdef DEBUG
printf("SIGINT armed.\n"); printf("SIGINT and SIGALRM armed.\n");
# endif # endif
} }