Skip to content

Commit

Permalink
lib-index: zero mmap_length after logging error
Browse files Browse the repository at this point in the history
Logging that mmap(size=0) failed looks suspicious.
  • Loading branch information
mrannanj authored and GitLab committed Feb 14, 2017
1 parent 532bb6c commit 7707c4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib-index/mail-cache.c
Expand Up @@ -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 :
Expand Down

0 comments on commit 7707c4b

Please sign in to comment.