[master] 45c79d0 Save the stv value to return within the protected reagion

Nils Goroll nils.goroll at uplex.de
Fri Nov 11 12:26:04 CET 2016


commit 45c79d06fd020bc60899b3fd6624fd7036d25535
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Nov 11 12:21:17 2016 +0100

    Save the stv value to return within the protected reagion
    
    commit c457b965383087714e3afcce60a763fbec295bb1 was incomplete
    
    This should fix #2128 for good

diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 6ecf8ee..c646bdd 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -52,6 +52,7 @@ const struct stevedore *
 STV_next()
 {
 	static struct stevedore *stv;
+	struct stevedore *r;
 	static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
 
 	AZ(pthread_mutex_lock(&mtx));
@@ -61,9 +62,10 @@ STV_next()
 		stv = NULL;
 		AN(STV__iter(&stv));
 	}
+	r = stv;
 	AZ(pthread_mutex_unlock(&mtx));
-	AN(stv);
-	return (stv);
+	AN(r);
+	return (r);
 }
 
 /*-------------------------------------------------------------------



More information about the varnish-commit mailing list