]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Cache file was never updated if the file existed but index didn't have cache extension.
authorTimo Sirainen <tss@iki.fi>
Tue, 14 Oct 2008 11:52:44 +0000 (14:52 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 14 Oct 2008 11:52:44 +0000 (14:52 +0300)
--HG--
branch : HEAD

src/lib-index/mail-cache-transaction.c

index 2f2708fee832e55d29f73127976aa52a28dc6950..12881aaeaa35b1c4e7ad28a0264578dba7642c2e 100644 (file)
@@ -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