From 1da9587dfb6632ac6446ad12b09fdf77c8542e2c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 15 Oct 2009 15:56:06 -0400 Subject: [PATCH] lib-index: Give nicer error if index's log position suddenly goes backwards. --HG-- branch : HEAD --- src/lib-index/mail-index-view-sync.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib-index/mail-index-view-sync.c b/src/lib-index/mail-index-view-sync.c index 79e5cabab6..1899b62872 100644 --- a/src/lib-index/mail-index-view-sync.c +++ b/src/lib-index/mail-index-view-sync.c @@ -55,6 +55,17 @@ view_sync_set_log_view_range(struct mail_index_view *view, bool sync_expunges, 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 */ ret = mail_transaction_log_view_set(view->log_view, -- 2.47.3