Skip to content

Commit

Permalink
lib-index: Fixed assert-crash caused by previous cache compression ch…
Browse files Browse the repository at this point in the history
…ange.

We can't call mail_cache_map() when cache file isn't open or we'll crash:

Panic: file mail-cache.c: line 468 (mail_cache_map): assertion failed: (cache->need_compress_file_seq != 0 || MAIL_INDEX_IS_IN_MEMORY(cache->index))
  • Loading branch information
sirainen committed May 23, 2016
1 parent 230586a commit 5b47087
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib-index/mail-cache-compress.c
Expand Up @@ -452,9 +452,11 @@ static int mail_cache_compress_locked(struct mail_cache *cache,

return mail_cache_reopen(cache) < 0 ? -1 : 0;
}
/* make sure we have mapped it before reading. */
if (mail_cache_map(cache, 0, 0, &data) < 0)
return -1;
if (cache->fd != -1) {
/* make sure we have mapped it before reading. */
if (mail_cache_map(cache, 0, 0, &data) < 0)
return -1;
}

/* we want to recreate the cache. write it first to a temporary file */
fd = mail_index_create_tmp_file(cache->index, cache->filepath, &temp_path);
Expand Down

0 comments on commit 5b47087

Please sign in to comment.