]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mail_cache_lock(): Return -1 if locking times out.
authorTimo Sirainen <tss@iki.fi>
Tue, 9 Sep 2008 15:30:23 +0000 (18:30 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 9 Sep 2008 15:30:23 +0000 (18:30 +0300)
This fixes cache compression starting even when locking timed out.

--HG--
branch : HEAD

src/lib-index/mail-cache-private.h
src/lib-index/mail-cache.c

index 4421078915148768b0cc27e53b219fa2ede67594..85abfca6061b7c4d7915f88e092679ce3f8a7cd4 100644 (file)
@@ -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);
index e6231002ffa52260e5ae5d2ff08ae1052b267ccf..4b9379d6b45a4140fbd814857eee4e5d98d3250a 100644 (file)
@@ -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 ||