]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: zero mmap_length after logging error
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Tue, 14 Feb 2017 08:42:26 +0000 (10:42 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 17 Feb 2017 09:32:31 +0000 (11:32 +0200)
Logging that mmap(size=0) failed looks suspicious.

src/lib-index/mail-cache.c

index abdd627c01ff443a7bc1acd1c4b39a5a2d792019..e1652323f22d598f1069250557c4f443bbdd1db5 100644 (file)
@@ -480,12 +480,12 @@ int mail_cache_map(struct mail_cache *cache, size_t offset, size_t size,
        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 :