diff --git a/src/utils.c b/src/utils.c index b07da9f4..e42bb8f7 100644 --- a/src/utils.c +++ b/src/utils.c @@ -2045,13 +2045,16 @@ run_with_timeout (double timeout, void (*fun) (void *), void *arg) return false; } - signal (SIGALRM, abort_run_with_timeout); if (SETJMP (run_with_timeout_env) != 0) { /* Longjumped out of FUN with a timeout. */ signal (SIGALRM, SIG_DFL); return true; } + else + { + signal (SIGALRM, abort_run_with_timeout); + } alarm_set (timeout); fun (arg);