dovecot-1.2: Cache file was never updated if the file existed bu...

dovecot at dovecot.org dovecot at dovecot.org
Tue Oct 14 14:52:48 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/40df4d4cced0
changeset: 8273:40df4d4cced0
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Oct 14 14:52:44 2008 +0300
description:
Cache file was never updated if the file existed but index didn't have cache extension.

diffstat:

1 file changed, 16 insertions(+), 12 deletions(-)
src/lib-index/mail-cache-transaction.c |   28 ++++++++++++++++------------

diffs (39 lines):

diff -r 434a8a0edc0a -r 40df4d4cced0 src/lib-index/mail-cache-transaction.c
--- a/src/lib-index/mail-cache-transaction.c	Tue Oct 14 00:58:13 2008 +0300
+++ b/src/lib-index/mail-cache-transaction.c	Tue Oct 14 14:52:44 2008 +0300
@@ -159,19 +159,23 @@ mail_cache_transaction_open_if_needed(st
 			return;
 
 		if (!mail_index_map_get_ext_idx(cache->index->map,
-						cache->ext_id, &idx))
-			return;
-
-		ext = array_idx(&cache->index->map->extensions, idx);
-		if (ext->reset_id == cache->hdr->file_seq || i == 2)
-			break;
-
-		/* index offsets don't match the cache file */
-		if (ext->reset_id > cache->hdr->file_seq) {
-			/* the cache file appears to be too old.
-			   reopening should help. */
-			if (mail_cache_reopen(cache) != 0)
+						cache->ext_id, &idx)) {
+			/* index doesn't have a cache extension, but the cache
+			   file exists (corrupted indexes fixed?). fix it. */
+			if (i == 2)
 				break;
+		} else {
+			ext = array_idx(&cache->index->map->extensions, idx);
+			if (ext->reset_id == cache->hdr->file_seq || i == 2)
+				break;
+
+			/* index offsets don't match the cache file */
+			if (ext->reset_id > cache->hdr->file_seq) {
+				/* the cache file appears to be too old.
+				   reopening should help. */
+				if (mail_cache_reopen(cache) != 0)
+					break;
+			}
 		}
 
 		/* cache file sequence might be broken. it's also possible


More information about the dovecot-cvs mailing list