From: Timo Sirainen Date: Tue, 14 Oct 2008 11:52:44 +0000 (+0300) Subject: Cache file was never updated if the file existed but index didn't have cache extension. X-Git-Tag: 1.2.alpha3~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fcaba5977f7d596632df1ed2af8541e5f154258;p=thirdparty%2Fdovecot%2Fcore.git Cache file was never updated if the file existed but index didn't have cache extension. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-cache-transaction.c b/src/lib-index/mail-cache-transaction.c index 2f2708fee8..12881aaeaa 100644 --- a/src/lib-index/mail-cache-transaction.c +++ b/src/lib-index/mail-cache-transaction.c @@ -159,19 +159,23 @@ mail_cache_transaction_open_if_needed(struct mail_cache_transaction_ctx *ctx) 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