This is especially required for "Header's corrupted flag is set" error,
which won't get fixed otherwise.
It's a bit more questionable if we should treat major version or CPU
architecture change as corruption, but it's possible those only exist
because of corruption. It's also very unlikely that either is really
happening. Ideally there would be a hash that verifies whether the
header is corrupted or not.
const struct mail_index_header *hdr = &map->hdr;
if (!mail_index_check_header_compat(index, hdr, (uoff_t)-1, error_r))
- return -1;
+ return 0;
/* following some extra checks that only take a bit of CPU */
if (hdr->record_size < sizeof(struct mail_index_record)) {
/* Can't use this file */
mail_index_set_error(index, "Corrupted index file %s: %s",
index->filepath, error);
- return -1;
+ return 0;
}
rec_map->mmap_used_size = hdr->header_size +
/* Can't use this file */
mail_index_set_error(index, "Corrupted index file %s: %s",
index->filepath, error);
- return -1;
+ return 0;
}
initial_buf_pos = pos;