From: Timo Sirainen Date: Tue, 9 Sep 2008 15:30:23 +0000 (+0300) Subject: mail_cache_lock(): Return -1 if locking times out. X-Git-Tag: 1.2.alpha2~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=84da9c6d6e162b064608cbfa9a47e0d60553c593;p=thirdparty%2Fdovecot%2Fcore.git mail_cache_lock(): Return -1 if locking times out. This fixes cache compression starting even when locking timed out. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-cache-private.h b/src/lib-index/mail-cache-private.h index 4421078915..85abfca606 100644 --- a/src/lib-index/mail-cache-private.h +++ b/src/lib-index/mail-cache-private.h @@ -220,8 +220,8 @@ struct mail_cache_lookup_iterate_ctx { int mail_cache_open_and_verify(struct mail_cache *cache); -/* Explicitly lock the cache file. Returns -1 if error, 1 if ok, 0 if we - couldn't lock */ +/* Explicitly lock the cache file. Returns -1 if error / timed out, + 1 if ok, 0 if cache is broken/doesn't exist */ int mail_cache_lock(struct mail_cache *cache, bool require_same_reset_id); /* Returns -1 if cache is / just got corrupted, 0 if ok. */ int mail_cache_unlock(struct mail_cache *cache); diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index e6231002ff..4b9379d6b4 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -538,9 +538,10 @@ int mail_cache_lock(struct mail_cache *cache, bool require_same_reset_id) break; } - ret = mail_cache_lock_file(cache); - if (ret <= 0) + if (mail_cache_lock_file(cache) <= 0) { + ret = -1; break; + } cache->locked = TRUE; if (cache->hdr->file_seq == reset_id ||