Mercurial > dovecot > core-2.2
changeset 15537:348e9bad84f0
lib-index: Fixed assert-crash caused by recent cache file changes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 28 Nov 2012 03:56:06 +0200 |
parents | e62938129955 |
children | 31ed1f5cc8f1 |
files | src/lib-index/mail-cache.c |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-cache.c Wed Nov 28 03:55:25 2012 +0200 +++ b/src/lib-index/mail-cache.c Wed Nov 28 03:56:06 2012 +0200 @@ -281,6 +281,7 @@ !MAIL_CACHE_IS_UNUSABLE(cache) && cache->hdr->file_seq != 0 ? cache->hdr->file_seq : 0; + cache->hdr = NULL; return -1; } } @@ -296,6 +297,7 @@ } else { i_assert(cache->hdr != NULL); } + i_assert(cache->hdr->file_seq != 0); if (offset + size > cache->mmap_length) return 0; @@ -365,8 +367,6 @@ return mail_cache_map_with_read(cache, offset, size, data_r); if (cache->file_cache != NULL) { - cache->hdr = NULL; - ret = file_cache_read(cache->file_cache, offset, size); if (ret < 0) { /* In case of ESTALE we'll simply fail without error @@ -378,6 +378,7 @@ offsets. */ if (errno != ESTALE) mail_cache_set_syscall_error(cache, "read()"); + cache->hdr = NULL; return -1; } @@ -385,7 +386,8 @@ &cache->mmap_length); *data_r = offset > cache->mmap_length ? NULL : CONST_PTR_OFFSET(data, offset); - return mail_cache_map_finish(cache, offset, size, data, TRUE); + return mail_cache_map_finish(cache, offset, size, + offset == 0 ? data : NULL, TRUE); } if (offset < cache->mmap_length &&