dovecot-2.2: mbox: If we notice our internal state is wrong, avo...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 13 16:28:46 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/1171265c3834
changeset: 18680:1171265c3834
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 13 19:26:45 2015 +0300
description:
mbox: If we notice our internal state is wrong, avoid further corruption by returning error.

diffstat:

 src/lib-storage/index/mbox/mbox-sync-rewrite.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r b6ea460e7cc4 -r 1171265c3834 src/lib-storage/index/mbox/mbox-sync-rewrite.c
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Wed May 13 19:24:55 2015 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Wed May 13 19:26:45 2015 +0300
@@ -429,6 +429,7 @@
 				" bytes, now needs %"PRIuSIZE_T" bytes",
 				seq, mails[idx].uid, mails[idx].uid_broken,
 				(uoff_t)-mails[idx].space, need_space);
+			return -1;
 		}
 	}
 
@@ -595,8 +596,10 @@
 		mails[idx].from_offset += move_diff;
 	}
 
-	i_assert(mails[idx].from_offset == start_offset);
-	i_assert(move_diff + (off_t)expunged_space >= 0);
+	if (ret == 0) {
+		i_assert(mails[idx].from_offset == start_offset);
+		i_assert(move_diff + (off_t)expunged_space >= 0);
+	}
 
 	mbox_sync_file_updated(sync_ctx, FALSE);
 	sync_ctx->prev_msg_uid = orig_prev_msg_uid;


More information about the dovecot-cvs mailing list