]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Give nicer error if index's log position suddenly goes backwards.
authorTimo Sirainen <tss@iki.fi>
Thu, 15 Oct 2009 19:56:06 +0000 (15:56 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 15 Oct 2009 19:56:06 +0000 (15:56 -0400)
--HG--
branch : HEAD

src/lib-index/mail-index-view-sync.c

index 79e5cabab6611664520865eefab2f81b5e6c7924..1899b6287209ea0033b77fb459431bc0e7b753dd 100644 (file)
@@ -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,