changeset 21537:8ebf69bd381b

lib-index: zero mmap_length after logging error Logging that mmap(size=0) failed looks suspicious.
author Martti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
date Tue, 14 Feb 2017 10:42:26 +0200
parents 35d26415f0bc
children cbb4cb127366
files src/lib-index/mail-cache.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-cache.c	Mon Feb 13 19:40:22 2017 +0200
+++ b/src/lib-index/mail-cache.c	Tue Feb 14 10:42:26 2017 +0200
@@ -480,12 +480,12 @@
 	cache->mmap_base = mmap_ro_file(cache->fd, &cache->mmap_length);
 	if (cache->mmap_base == MAP_FAILED) {
 		cache->mmap_base = NULL;
-		cache->mmap_length = 0;
 		if (ioloop_time != cache->last_mmap_error_time) {
 			cache->last_mmap_error_time = ioloop_time;
 			mail_cache_set_syscall_error(cache, t_strdup_printf(
 				"mmap(size=%"PRIuSIZE_T")", cache->mmap_length));
 		}
+		cache->mmap_length = 0;
 		return -1;
 	}
 	*data_r = offset > cache->mmap_length ? NULL :