/* transaction log is closed already. this log view shouldn't
be used anymore. */
*reason_r = "Log already closed";
- return -1;
+ return 0;
}
if (min_file_seq == 0) {
") > max_file_offset (%"PRIuUOFF_T")",
min_file_seq, min_file_offset, max_file_offset);
mail_transaction_log_view_set_corrupted(view, "%s", *reason_r);
- return -1;
+ return 0;
}
view->tail = view->head = file = NULL;
") < hdr_size (%u)",
min_file_seq, min_file_offset, view->tail->hdr.hdr_size);
mail_transaction_log_view_set_corrupted(view, "%s", *reason_r);
- return -1;
+ return 0;
}
if (max_file_offset < view->head->hdr.hdr_size) {
/* log file offset is probably corrupted in the index file. */
") < hdr_size (%u)",
max_file_seq, max_file_offset, view->head->hdr.hdr_size);
mail_transaction_log_view_set_corrupted(view, "%s", *reason_r);
- return -1;
+ return 0;
}
/* we have all of them. update refcounts. */
") > sync_offset (%"PRIuUOFF_T")", min_file_seq,
min_file_offset, view->head->sync_offset);
mail_transaction_log_view_set_corrupted(view, "%s", *reason_r);
- return -1;
+ return 0;
}
i_assert(max_file_seq == (uint32_t)-1 ||
view->max_file_offset = I_MIN(max_file_offset, view->head->sync_offset);
view->broken = FALSE;
- if (mail_transaction_log_file_get_highest_modseq_at(view->cur,
- view->cur_offset, &view->prev_modseq, reason_r) <= 0)
- return -1;
+ ret = mail_transaction_log_file_get_highest_modseq_at(view->cur,
+ view->cur_offset, &view->prev_modseq, reason_r);
+ if (ret <= 0)
+ return ret;
i_assert(view->cur_offset <= view->cur->sync_offset);
return 1;
mail_transaction_log_view_open(struct mail_transaction_log *log);
void mail_transaction_log_view_close(struct mail_transaction_log_view **view);
-/* Set view boundaries. Returns -1 if error, 0 if files are lost or corrupted,
- 1 if ok. reset_r=TRUE if the whole index should be reset before applying any
- changes. */
+/* Set view boundaries. Returns 1 if ok, 0 if files are lost, corrupted or the
+ offsets are broken, -1 if I/O error. reset_r=TRUE if the whole index should
+ be reset before applying any changes. */
int mail_transaction_log_view_set(struct mail_transaction_log_view *view,
uint32_t min_file_seq, uoff_t min_file_offset,
uint32_t max_file_seq, uoff_t max_file_offset,
test_begin("closed log handling");
view->log = NULL;
- test_assert(mail_transaction_log_view_set(view, 0, 0, (uint32_t)-1, UOFF_T_MAX, &reset, &reason) == -1);
+ test_assert(mail_transaction_log_view_set(view, 0, 0, (uint32_t)-1, UOFF_T_MAX, &reset, &reason) == 0);
view->log = log;
test_end();