From 0c5196e773b325988fbe36dd595c978b29805ff8 Mon Sep 17 00:00:00 2001 From: Francesco Lannutti Date: Sun, 5 Jul 2015 13:08:59 +0200 Subject: [PATCH] signal_handler.c, ft_sigintr(), exit after three SIGINT requests --- src/frontend/signal_handler.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/frontend/signal_handler.c b/src/frontend/signal_handler.c index 204d54ab6..6a53c633f 100644 --- a/src/frontend/signal_handler.c +++ b/src/frontend/signal_handler.c @@ -73,6 +73,8 @@ ft_sigintr_cleanup(void) RETSIGTYPE ft_sigintr(void) { + static int interrupt_counter = 0; + /* fprintf(cp_err, "Received interrupt. Handling it . . . . .\n"); */ /* 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 */ fprintf(cp_err, "\nInterrupted again (ouch)\n"); + interrupt_counter++; } else { fprintf(cp_err, "\nInterrupted once . . .\n"); 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) {