[master] eed828937 Add an assert to try to catch #1853

Poul-Henning Kamp phk at FreeBSD.org
Thu Aug 22 07:43:06 UTC 2019


commit eed8289377394440c6c111f431f031735485d5ac
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Aug 22 07:38:43 2019 +0000

    Add an assert to try to catch #1853

diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index 87dceb5ca..3d7dd74d8 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -212,6 +212,7 @@ Lck_CondWait(pthread_cond_t *cond, struct lock *lck, vtim_real when)
 		assert(when > 1e9);
 		ts.tv_nsec = (long)(modf(when, &t) * 1e9);
 		ts.tv_sec = (long)t;
+		assert(ts.tv_nsec >= 0 && ts.tv_nsec < 999999999);
 		errno = pthread_cond_timedwait(cond, &ilck->mtx, &ts);
 		assert(errno == 0 ||
 		    errno == ETIMEDOUT ||


More information about the varnish-commit mailing list