From aa00f068e39e49f312cbe48da8a64f532100dfb5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 1 Jun 2010 20:00:07 +0100 Subject: [PATCH] mdbox: When rebuilding storage, don't use map records that have wrong size. --HG-- branch : HEAD --- src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c | 6 ++++++ 1 file changed, 6 insertions(+) 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) { -- 2.47.3