diff --git a/src/reset_timeout.c b/src/reset_timeout.c index db54ce0ccaddb4404127ddc94335f2ad5a47aec6..7c14ab1c317973624e375c7787fcb9521e5f7a20 100644 --- a/src/reset_timeout.c +++ b/src/reset_timeout.c @@ -19,19 +19,22 @@ void reset_binary_c_timeout(void) { #ifndef __HAVE_SETITIMER__ - /* - * We don't have setitimer but we do want a timeout: - * exit with a warning. - */ - Exit_binary_c_no_stardata(BINARY_C_TIMED_OUT, - "TIMEOUT_SECONDS is set to %ld but we have no access to setitimer to actually set the timeout. This will cause binary_c to not have a timeout, even though you have asked for it. Please set TIMEOUT_SECONDS to 0 in binary_c_code_options.h to fix this problem, or build on an operating system that supports setitimer.", - (long int)TIMEOUT_SECONDS); - + if(TIMEOUT_SECONDS != 0) + { + /* + * We don't have setitimer but we do want a timeout: + * exit with a warning. + */ + Exit_binary_c_no_stardata(BINARY_C_TIMED_OUT, + "TIMEOUT_SECONDS is set to %ld but we have no access to setitimer to actually set the timeout. This will cause binary_c to not have a timeout, even though you have asked for it. Please set TIMEOUT_SECONDS to 0 in binary_c_code_options.h to fix this problem, or build on an operating system that supports setitimer.", + (long int)TIMEOUT_SECONDS); + } #else /* - * We have setitimer + * We have setitimer, so if TIMEOUT_SECONDS is non-zero, + * set the timer. */ - if(TIMEOUT_SECONDS) + if(TIMEOUT_SECONDS != 0) { /* Timing */ struct itimerval value; @@ -66,7 +69,11 @@ void reset_binary_c_timeout(void) void disable_binary_c_timeout(void) { #ifdef __HAVE_SETITIMER__ - if(TIMEOUT_SECONDS) + /* + * disable the timer if it could have been set (i.e. if + * TIMEOUT_SECONDS is non-zero) + */ + if(TIMEOUT_SECONDS != 0) { struct itimerval value; struct timeval tv;