]> err.no Git - varnish/commitdiff
Explicitly initialize errno to zero before mutex ops.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 25 Feb 2008 18:42:07 +0000 (18:42 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 25 Feb 2008 18:42:07 +0000 (18:42 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2538 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h

index b0ca9ab233f0a46ef0e3466d21131164c0c47b5a..e882dc9d686eb75c815390f2834c1a1cfd6e1388 100644 (file)
@@ -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,                               \