[asterisk-commits] sched.c: Add warning about negative time interval request. (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 2 16:27:03 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: sched.c: Add warning about negative time interval request.
......................................................................


sched.c: Add warning about negative time interval request.

Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc
---
M main/sched.c
1 file changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/main/sched.c b/main/sched.c
index f00b152..366bb9a 100644
--- a/main/sched.c
+++ b/main/sched.c
@@ -474,6 +474,17 @@
 {
 	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;

-- 
To view, visit https://gerrit.asterisk.org/1349
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-commits mailing list