[master] 49334d854 This addition supposedly fixed #1853, but on the face of it, it looks like the sign is wrong, we should never get EINVAL if the deadline is in the future.

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


commit 49334d854edd7f00bc4820c834e4af42fbd8a02d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 22 13:05:20 2021 +0000

    This addition supposedly fixed #1853, but on the face of it, it looks
    like the sign is wrong, we should never get EINVAL if the deadline is
    in the future.
    
    Fix the test to make sense, and hope for the best (or a M1 :-)
    
    Spotted by: Rasmus Villemoes

diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index a8f3d2f36..16c266291 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -221,7 +221,7 @@ Lck_CondWait(pthread_cond_t *cond, struct lock *lck, vtim_real when)
 		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()) {
+		if (errno == EINVAL && when <= VTIM_real()) {
 			/*
 			 * Most kernels treat this as honest error,
 			 * recognizing that a thread has no way to


More information about the varnish-commit mailing list