Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8181:5c0c674eae1a HEAD
mail_cache_lock(): Return -1 if locking times out.
This fixes cache compression starting even when locking timed out.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 09 Sep 2008 18:30:23 +0300 |
parents | f6838eb4e0e6 |
children | 4bfe2c1c375f |
files | src/lib-index/mail-cache-private.h src/lib-index/mail-cache.c |
diffstat | 2 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-cache-private.h Tue Sep 09 17:35:39 2008 +0300 +++ b/src/lib-index/mail-cache-private.h Tue Sep 09 18:30:23 2008 +0300 @@ -220,8 +220,8 @@ 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);
--- a/src/lib-index/mail-cache.c Tue Sep 09 17:35:39 2008 +0300 +++ b/src/lib-index/mail-cache.c Tue Sep 09 18:30:23 2008 +0300 @@ -538,9 +538,10 @@ 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 ||