From: Timo Sirainen Date: Tue, 4 Nov 2003 22:26:16 +0000 (+0200) Subject: we didn't sync mbox again after rewriting which left us broken mail offsets. X-Git-Tag: 1.1.alpha1~4246 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec71c9b797276b247761ae84f04014ac95f76f05;p=thirdparty%2Fdovecot%2Fcore.git we didn't sync mbox again after rewriting which left us broken mail offsets. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index.h b/src/lib-index/mail-index.h index aa7809a3d4..699a190542 100644 --- a/src/lib-index/mail-index.h +++ b/src/lib-index/mail-index.h @@ -339,6 +339,7 @@ struct mail_index { unsigned int anon_mmap:1; unsigned int mmap_invalidate:1; + unsigned int mbox_rewritten:1; unsigned int opened:1; unsigned int rebuilding:1; unsigned int mail_read_mmaped:1; @@ -368,7 +369,7 @@ struct mail_index { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0 + 0, 0 #endif /* defaults - same as above but prefixed with mail_index_. */ diff --git a/src/lib-index/mbox/mbox-rewrite.c b/src/lib-index/mbox/mbox-rewrite.c index 089cbc536f..9d66141928 100644 --- a/src/lib-index/mbox/mbox-rewrite.c +++ b/src/lib-index/mbox/mbox-rewrite.c @@ -610,6 +610,9 @@ int mbox_index_rewrite(struct mail_index *index) return TRUE; } + /* kludgy .. but we need to force resyncing */ + index->mbox_rewritten = TRUE; + tmp_fd = -1; input = NULL; failed = TRUE; rewrite = FALSE; do { diff --git a/src/lib-index/mbox/mbox-sync-full.c b/src/lib-index/mbox/mbox-sync-full.c index 1d447c677c..c290d58338 100644 --- a/src/lib-index/mbox/mbox-sync-full.c +++ b/src/lib-index/mbox/mbox-sync-full.c @@ -329,6 +329,13 @@ int mbox_sync_full(struct mail_index *index) failed = !mbox_sync_from_stream(index, input); } + if (index->mbox_rewritten) { + /* rewritten, sync again */ + index->mbox_rewritten = FALSE; + i_stream_seek(input, 0); + failed = !mbox_sync_from_stream(index, input); + } + i_stream_unref(input); }