]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: Don't assert-cras if refcount in map file is too low.
authorTimo Sirainen <tss@iki.fi>
Tue, 2 Mar 2010 13:42:50 +0000 (15:42 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 2 Mar 2010 13:42:50 +0000 (15:42 +0200)
--HG--
branch : HEAD

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

index bc09d51f26a211339e8e7037264daf6eeb8776a7..db222c2b332620ccbdc16fa98afd3730d793a756 100644 (file)
@@ -427,7 +427,11 @@ int dbox_map_update_refcounts(struct dbox_map_transaction_context *ctx,
                ctx->changed = TRUE;
                cur_diff += mail_index_atomic_inc_ext(ctx->trans, seq,
                                                      map->ref_ext_id, diff);
-               i_assert(cur_diff >= 0);
+               if (cur_diff < 0) {
+                       dbox_map_set_corrupted(map,
+                               "map_uid=%u refcount too low", *uidp);
+                       return -1;
+               }
                if (cur_diff >= 32768) {
                        /* we're getting close to the 64k limit. fail early
                           to make it less likely that two processes increase