dovecot-1.2: lib-index: Give nicer error if index's log position...

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 15 22:56:12 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/6c6460531514
changeset: 9433:6c6460531514
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 15 15:56:06 2009 -0400
description:
lib-index: Give nicer error if index's log position suddenly goes backwards.

diffstat:

1 file changed, 11 insertions(+)
src/lib-index/mail-index-view-sync.c |   11 +++++++++++

diffs (21 lines):

diff -r 439e14ff1467 -r 6c6460531514 src/lib-index/mail-index-view-sync.c
--- a/src/lib-index/mail-index-view-sync.c	Thu Oct 15 13:51:00 2009 -0400
+++ b/src/lib-index/mail-index-view-sync.c	Thu Oct 15 15:56:06 2009 -0400
@@ -54,6 +54,17 @@ view_sync_set_log_view_range(struct mail
 	start_offset = view->log_file_expunge_offset;
 	end_seq = hdr->log_file_seq;
 	end_offset = hdr->log_file_head_offset;
+
+	if (end_seq < view->log_file_head_seq ||
+	    (end_seq == view->log_file_head_seq &&
+	     end_offset < view->log_file_head_offset)) {
+		mail_index_set_error(view->index,
+			"%s log position went backwards "
+			"(%u,%"PRIuUOFF_T" < %u,%"PRIuUOFF_T")",
+			view->index->filepath, end_seq, end_offset,
+			view->log_file_head_seq, view->log_file_head_offset);
+		return -1;
+	}
 
 	for (;;) {
 		/* the view begins from the first non-synced transaction */


More information about the dovecot-cvs mailing list