The readonly-flag is used when rebuilding index or dumping indexes.
In both cases it's better to try to open the index as best as possible,
since fsck isn't allowed.
"(reopen_reason: %s)",
index->filepath, reason, map_reason,
reopen_reason);
- if (mail_index_fsck(index) < 0)
- return -1;
+ if (!index->readonly) {
+ if (mail_index_fsck(index) < 0)
+ return -1;
+ }
}
ret = mail_index_map_latest_file(index, &reason);
return 0;
ret = mail_index_map(index, MAIL_INDEX_SYNC_HANDLER_HEAD);
- if (ret == 0) {
+ if (ret == 0 && !index->readonly) {
/* it's corrupted - recreate it */
if (index->fd != -1) {
if (close(index->fd) < 0)
}
if (ret >= 0) {
ret = index->map != NULL ? 1 : mail_index_try_open(index);
- if (ret == 0) {
+ if (ret == 0 && !index->readonly) {
/* corrupted */
mail_transaction_log_close(index->log);
ret = mail_transaction_log_create(index->log, TRUE);