[4.1] 7fc09f9 Hijack errno in Lck_CondWait
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Mon Apr 24 17:16:06 CEST 2017
commit 7fc09f9e906236b3b2e6264bd782cea56a5c009c
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Mar 13 13:04:54 2017 +0100
Hijack errno in Lck_CondWait
This should help diagnose #2253.
diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index 90190dc..8284340 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -184,7 +184,6 @@ int __match_proto__()
Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double when)
{
struct ilck *ilck;
- int retval = 0;
struct timespec ts;
double t;
@@ -193,19 +192,20 @@ Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double when)
assert(pthread_equal(ilck->owner, pthread_self()));
ilck->held = 0;
if (when == 0) {
- AZ(pthread_cond_wait(cond, &ilck->mtx));
+ errno = pthread_cond_wait(cond, &ilck->mtx);
+ AZ(errno);
} else {
ts.tv_nsec = (long)(modf(when, &t) * 1e9);
ts.tv_sec = (long)t;
- retval = pthread_cond_timedwait(cond, &ilck->mtx, &ts);
- assert(retval == 0 ||
- retval == ETIMEDOUT ||
- retval == EINTR);
+ errno = pthread_cond_timedwait(cond, &ilck->mtx, &ts);
+ assert(errno == 0 ||
+ errno == ETIMEDOUT ||
+ errno == EINTR);
}
AZ(ilck->held);
ilck->held = 1;
ilck->owner = pthread_self();
- return (retval);
+ return (errno);
}
void
More information about the varnish-commit
mailing list