dovecot: Fixed opening indexes to memory.

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 9 03:59:31 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/c54c07f30a97
changeset: 6359:c54c07f30a97
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 09 03:59:09 2007 +0300
description:
Fixed opening indexes to memory.

diffstat:

1 file changed, 8 insertions(+), 3 deletions(-)
src/lib-index/mail-index.c |   11 ++++++++---

diffs (30 lines):

diff -r 6bd13d514294 -r c54c07f30a97 src/lib-index/mail-index.c
--- a/src/lib-index/mail-index.c	Sun Sep 09 03:58:57 2007 +0300
+++ b/src/lib-index/mail-index.c	Sun Sep 09 03:59:09 2007 +0300
@@ -415,9 +415,11 @@ static bool mail_index_open_files(struct
 		(void)mail_index_try_open(index);
 
 		if (index->indexid == 0) {
-			/* create a new indexid for us */
+			/* Create a new indexid for us. If we're opening index
+			   into memory, index->map doesn't exist yet. */
 			index->indexid = ioloop_time;
-			index->map->hdr.indexid = index->indexid;
+			if (index->map != NULL)
+				index->map->hdr.indexid = index->indexid;
 		}
 
 		ret = mail_transaction_log_create(index->log);
@@ -429,8 +431,11 @@ static bool mail_index_open_files(struct
 			/* doesn't exist / corrupted */
 			mail_transaction_log_close(index->log);
 			ret = mail_transaction_log_create(index->log);
-			if (ret == 0)
+			if (ret == 0) {
+				if (index->map != NULL)
+					mail_index_unmap(&index->map);
 				index->map = mail_index_map_alloc(index);
+			}
 		}
 	}
 	if (ret < 0) {


More information about the dovecot-cvs mailing list