]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
assert fix
authorTimo Sirainen <tss@iki.fi>
Sun, 30 May 2004 04:28:07 +0000 (07:28 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 30 May 2004 04:28:07 +0000 (07:28 +0300)
--HG--
branch : HEAD

src/lib-index/mail-transaction-log-view.c

index 5aae3da585b7da1b640d719c0536d726cabdd8a0..97c08bf9a9c4b8533ccdb6043599053a3d6ac563 100644 (file)
@@ -88,33 +88,27 @@ mail_transaction_log_view_set(struct mail_transaction_log_view *view,
        if (view->log == NULL)
                return -1;
 
-       ret = mail_transaction_log_file_find(view->log, min_file_seq, &file);
-       if (ret <= 0) {
-               if (ret == 0 &&
-                   min_file_seq == view->log->tail->hdr.prev_file_seq &&
-                   min_file_offset == view->log->tail->hdr.prev_file_offset) {
-                       /* we can skip this */
-                       min_file_seq = view->log->tail->hdr.file_seq;
-                       min_file_offset =
-                               sizeof(struct mail_transaction_log_header);
-                       ret = mail_transaction_log_file_find(view->log,
-                                                            min_file_seq,
-                                                            &file);
+       if (min_file_seq == view->log->tail->hdr.prev_file_seq &&
+           min_file_offset == view->log->tail->hdr.prev_file_offset) {
+               /* we can skip this */
+               min_file_seq = view->log->tail->hdr.file_seq;
+               min_file_offset = sizeof(struct mail_transaction_log_header);
+
+               if (min_file_seq > max_file_seq) {
+                       /* empty view */
+                       max_file_seq = min_file_seq;
+                       max_file_offset = min_file_offset;
                }
+       }
 
+       ret = mail_transaction_log_file_find(view->log, min_file_seq, &file);
+       if (ret <= 0) {
                if (ret == 0) {
                        mail_index_set_error(view->log->index,
                                "Lost transaction log file %s seq %u",
                                view->log->tail->filepath, min_file_seq);
                }
-               if (ret <= 0)
-                       return -1;
-
-               if (min_file_seq > max_file_seq) {
-                       /* empty view */
-                       max_file_seq = min_file_seq;
-                       max_file_offset = min_file_offset;
-               }
+               return -1;
        }
 
        /* check these later than others as index file may have corrupted
@@ -154,8 +148,9 @@ mail_transaction_log_view_set(struct mail_transaction_log_view *view,
                        file->refcount--;
                view->tail = first;
        } else {
-               /* we shouldn't go backwards in log */
-               i_assert(first == view->tail);
+               /* going backwards, reference them */
+               for (file = first; file != view->tail; file = file->next)
+                       file->refcount++;
        }
 
        /* reference all new files */