From: Timo Sirainen Date: Sun, 30 May 2004 04:28:07 +0000 (+0300) Subject: assert fix X-Git-Tag: 1.1.alpha1~4021 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9df8c9225140d9d1df5ddf4c6c9da61662ae6c44;p=thirdparty%2Fdovecot%2Fcore.git assert fix --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-transaction-log-view.c b/src/lib-index/mail-transaction-log-view.c index 5aae3da585..97c08bf9a9 100644 --- a/src/lib-index/mail-transaction-log-view.c +++ b/src/lib-index/mail-transaction-log-view.c @@ -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 */