From: Richard Mudgett Date: Mon, 28 Sep 2015 20:31:38 +0000 (-0500) Subject: sched.c: Add warning about negative time interval request. X-Git-Tag: 11.20.0-rc2~2^2~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6803444ac14bcd7f70bb028e9e319785a5335a79;p=thirdparty%2Fasterisk.git sched.c: Add warning about negative time interval request. Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc --- diff --git a/main/sched.c b/main/sched.c index f00b152783..366bb9a24f 100644 --- a/main/sched.c +++ b/main/sched.c @@ -474,6 +474,17 @@ static int sched_settime(struct timeval *t, int when) { struct timeval now = ast_tvnow(); + if (when < 0) { + /* + * A negative when value is likely a bug as it + * represents a VERY large timeout time. + */ + ast_log(LOG_WARNING, + "Bug likely: Negative time interval %d (interpreted as %u ms) requested!\n", + when, (unsigned int) when); + ast_assert(0); + } + /*ast_debug(1, "TV -> %lu,%lu\n", tv->tv_sec, tv->tv_usec);*/ if (ast_tvzero(*t)) /* not supplied, default to now */ *t = now;