changeset 20040:4da8d743d98f

lib-index: Fixed calling mail_cache_open_and_verify() on an already open cache. This was done at least by index_index_rebuild_init(). Either the currently open cache->fd was leaked, or if the cache file open() failed we left the cache in an inconsistent state where cache->fd == -1, but cache->hdr != NULL, so it caused MAIL_CACHE_IS_UNUSABLE() to also be TRUE. This could have ended up in an assert: Panic: file mail-index-lock.c: line 31 (mail_index_lock_fd): assertion failed: (MAIL_INDEX_IS_IN_MEMORY(index))
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 20 Apr 2016 00:29:49 +0300
parents c9eff5541312
children 4d83654e61d6
files src/lib-index/mail-cache.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-cache.c	Wed Apr 20 02:47:13 2016 +0300
+++ b/src/lib-index/mail-cache.c	Wed Apr 20 00:29:49 2016 +0300
@@ -487,6 +487,8 @@
 {
 	int ret;
 
+	if (cache->opened)
+		return 0;
 	ret = mail_cache_try_open(cache);
 	if (ret > 0)
 		ret = mail_cache_header_fields_read(cache);