r2538 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Feb 25 19:42:07 CET 2008


Author: phk
Date: 2008-02-25 19:42:07 +0100 (Mon, 25 Feb 2008)
New Revision: 2538

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
Log:
Explicitly initialize errno to zero before mutex ops.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2008-02-23 20:36:33 UTC (rev 2537)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2008-02-25 18:42:07 UTC (rev 2538)
@@ -589,6 +589,7 @@
 #define MTX_DESTROY(foo)	AZ(pthread_mutex_destroy(foo))
 #define TRYLOCK(foo, r)						\
 do {								\
+	errno = 0;						\
 	(r) = pthread_mutex_trylock(foo);			\
 	assert((r) == 0 || errno == EBUSY);			\
 	if (params->diag_bitmap & 0x8) {			\
@@ -599,6 +600,7 @@
 } while (0)
 #define LOCK(foo) 						\
 do { 								\
+	errno = 0;						\
 	if (!(params->diag_bitmap & 0x18)) {			\
 		AZ(pthread_mutex_lock(foo)); 			\
 	} else if (pthread_mutex_trylock(foo)) {		\
@@ -614,6 +616,7 @@
 } while (0)
 #define UNLOCK(foo)						\
 do {								\
+	errno = 0;						\
 	AZ(pthread_mutex_unlock(foo));				\
 	if (params->diag_bitmap & 0x8)				\
 		VSL(SLT_Debug, 0,				\




More information about the varnish-commit mailing list