This could have caused at least errors like:
Corrupted index cache file .../dovecot.index.cache: File too small
I'm not sure if it might have also returned stale data sometimes.
Easy way to reproduce this bug was:
imaptest copy=100 copybox=Trash &
imaptest box=Trash append=0
if (cache->file_cache != NULL)
file_cache_set_fd(cache->file_cache, -1);
+ if (cache->read_buf != NULL)
+ buffer_set_used_size(cache->read_buf, 0);
cache->mmap_base = NULL;
cache->hdr = NULL;
/* map the whole file */
cache->hdr = NULL;
cache->mmap_length = 0;
+ if (cache->read_buf != NULL)
+ buffer_set_used_size(cache->read_buf, 0);
cache->mmap_base = mmap_ro_file(cache->fd, &cache->mmap_length);
if (cache->mmap_base == MAP_FAILED) {