dovecot-2.2: lib-index: The previous assert-crashfix didn't actu...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 6 16:43:36 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/664ec741de8c
changeset: 16331:664ec741de8c
user: Timo Sirainen <tss at iki.fi>
date: Mon May 06 16:43:29 2013 +0300
description:
lib-index: The previous assert-crashfix didn't actually fix the problem.
diffstat:
src/lib-index/mail-transaction-log-view.c | 44 +++++++++++++++---------------
1 files changed, 22 insertions(+), 22 deletions(-)
diffs (75 lines):
diff -r 3de486622779 -r 664ec741de8c src/lib-index/mail-transaction-log-view.c
--- a/src/lib-index/mail-transaction-log-view.c Mon May 06 15:17:49 2013 +0300
+++ b/src/lib-index/mail-transaction-log-view.c Mon May 06 16:43:29 2013 +0300
@@ -95,24 +95,18 @@
}
for (file = view->log->files; file != NULL; file = file->next) {
- if (file->hdr.prev_file_seq == min_file_seq)
+ if (file->hdr.prev_file_seq == max_file_seq)
break;
}
- if (file != NULL && min_file_offset == file->hdr.prev_file_offset) {
+ if (file != NULL && max_file_offset == file->hdr.prev_file_offset) {
/* we can skip to the next file. we've delayed checking for
min_file_seq <= max_file_seq until now, because it's not
really an error to specify the same position twice (even if
in "wrong" order) */
i_assert(min_file_seq <= max_file_seq ||
- file->hdr.file_seq <= max_file_seq);
- min_file_seq = file->hdr.file_seq;
- min_file_offset = 0;
-
- if (min_file_seq > max_file_seq) {
- /* empty view */
- max_file_seq = min_file_seq;
- max_file_offset = min_file_offset;
- }
+ min_file_seq <= file->hdr.file_seq);
+ max_file_seq = file->hdr.file_seq;
+ max_file_offset = file->hdr.hdr_size;
} else {
i_assert(min_file_seq <= max_file_seq);
}
@@ -126,16 +120,6 @@
return -1;
}
- if (min_file_offset > 0 && file != NULL &&
- min_file_offset < file->hdr.hdr_size) {
- /* log file offset is probably corrupted in the index file. */
- mail_transaction_log_view_set_corrupted(view,
- "file_seq=%u, min_file_offset (%"PRIuUOFF_T
- ") < hdr_size (%u)",
- min_file_seq, min_file_offset, file->hdr.hdr_size);
- return -1;
- }
-
view->tail = view->head = file = NULL;
for (seq = min_file_seq; seq <= max_file_seq; seq++) {
if (file == NULL || file->hdr.file_seq != seq) {
@@ -200,7 +184,23 @@
max_file_offset = min_file_offset;
}
}
- i_assert(min_file_offset >= view->tail->hdr.hdr_size);
+
+ if (min_file_offset < view->tail->hdr.hdr_size) {
+ /* log file offset is probably corrupted in the index file. */
+ mail_transaction_log_view_set_corrupted(view,
+ "file_seq=%u, min_file_offset (%"PRIuUOFF_T
+ ") < hdr_size (%u)",
+ min_file_seq, min_file_offset, view->tail->hdr.hdr_size);
+ return -1;
+ }
+ if (max_file_offset < view->head->hdr.hdr_size) {
+ /* log file offset is probably corrupted in the index file. */
+ mail_transaction_log_view_set_corrupted(view,
+ "file_seq=%u, min_file_offset (%"PRIuUOFF_T
+ ") < hdr_size (%u)",
+ max_file_seq, max_file_offset, view->head->hdr.hdr_size);
+ return -1;
+ }
/* we have all of them. update refcounts. */
mail_transaction_log_view_unref_all(view);
More information about the dovecot-cvs
mailing list