From: Timo Sirainen Date: Tue, 1 Jun 2010 19:00:07 +0000 (+0100) Subject: mdbox: When rebuilding storage, don't use map records that have wrong size. X-Git-Tag: 2.0.beta6~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aa00f068e39e49f312cbe48da8a64f532100dfb5;p=thirdparty%2Fdovecot%2Fcore.git mdbox: When rebuilding storage, don't use map records that have wrong size. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c index d37df55d5c..89604803e7 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c @@ -123,6 +123,11 @@ static int mdbox_rebuild_msg_offset_cmp(const void *p1, const void *p2) return -1; if ((*m1)->offset > (*m2)->offset) return 1; + + if ((*m1)->size < (*m2)->size) + return -1; + if ((*m1)->size > (*m2)->size) + return 1; return 0; } @@ -300,6 +305,7 @@ static int rebuild_apply_map(struct mdbox_storage_rebuild_context *ctx) /* look up the rebuild msg record for this message */ search_msg.file_id = rec.rec.file_id; search_msg.offset = rec.rec.offset; + search_msg.size = rec.rec.size; pos = bsearch(&search_msgp, msgs, count, sizeof(*msgs), mdbox_rebuild_msg_offset_cmp); if (pos == NULL || (*pos)->map_uid != 0) {