]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: When rebuilding storage, don't use map records that have wrong size.
authorTimo Sirainen <tss@iki.fi>
Tue, 1 Jun 2010 19:00:07 +0000 (20:00 +0100)
committerTimo Sirainen <tss@iki.fi>
Tue, 1 Jun 2010 19:00:07 +0000 (20:00 +0100)
--HG--
branch : HEAD

src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c

index d37df55d5c65ceebd7bfe3d698c207e0bd909dec..89604803e7de684f124d1098d8d83743e312da35 100644 (file)
@@ -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) {