[master] 532dcd3fb Close a one-in-a-billion risk of unwarranted panic.

Poul-Henning Kamp phk at FreeBSD.org
Mon Feb 22 13:27:07 UTC 2021


commit 532dcd3fbfea5cafb8fb628d0826c85a8ad38b44
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 22 12:56:48 2021 +0000

    Close a one-in-a-billion risk of unwarranted panic.
    
    Spotted by:     Rasmus Villemoes

diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index 7af1a5712..a8f3d2f36 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -218,7 +218,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);
+		assert(ts.tv_nsec >= 0 && ts.tv_nsec <= 999999999);
 		errno = pthread_cond_timedwait(cond, &ilck->mtx, &ts);
 #if defined (__APPLE__)
 		if (errno == EINVAL && when > VTIM_real()) {


More information about the varnish-commit mailing list