Browse Source

signal_handler.c, ft_sigintr(), exit after three SIGINT requests

pre-master-46
Francesco Lannutti 11 years ago
committed by rlar
parent
commit
0c5196e773
  1. 9
      src/frontend/signal_handler.c

9
src/frontend/signal_handler.c

@ -73,6 +73,8 @@ ft_sigintr_cleanup(void)
RETSIGTYPE RETSIGTYPE
ft_sigintr(void) ft_sigintr(void)
{ {
static int interrupt_counter = 0;
/* fprintf(cp_err, "Received interrupt. Handling it . . . . .\n"); */ /* fprintf(cp_err, "Received interrupt. Handling it . . . . .\n"); */
/* Reinstall ft_signintr as the signal handler. */ /* Reinstall ft_signintr as the signal handler. */
@ -80,9 +82,16 @@ ft_sigintr(void)
if (ft_intrpt) { /* check to see if we're being interrupted repeatedly */ if (ft_intrpt) { /* check to see if we're being interrupted repeatedly */
fprintf(cp_err, "\nInterrupted again (ouch)\n"); fprintf(cp_err, "\nInterrupted again (ouch)\n");
interrupt_counter++;
} else { } else {
fprintf(cp_err, "\nInterrupted once . . .\n"); fprintf(cp_err, "\nInterrupted once . . .\n");
ft_intrpt = TRUE; ft_intrpt = TRUE;
interrupt_counter = 1;
}
if (interrupt_counter >= 3) {
fprintf(cp_err, "\nKilling, since %d interrupts have been requested\n\n", interrupt_counter);
controlled_exit(1);
} }
if (ft_setflag) { if (ft_setflag) {

Loading…
Cancel
Save