From: phk Date: Mon, 25 Feb 2008 18:42:07 +0000 (+0000) Subject: Explicitly initialize errno to zero before mutex ops. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7113f83547b57735f2f158400313500fcc6635b1;p=varnish Explicitly initialize errno to zero before mutex ops. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2538 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index b0ca9ab2..e882dc9d 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -589,6 +589,7 @@ int RFC2616_cache_policy(const struct sess *sp, const struct http *hp); #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 @@ do { \ } 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 @@ do { \ } while (0) #define UNLOCK(foo) \ do { \ + errno = 0; \ AZ(pthread_mutex_unlock(foo)); \ if (params->diag_bitmap & 0x8) \ VSL(SLT_Debug, 0, \