[dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.73, 1.74 mail-index.c, 1.242, 1.243

tss at dovecot.org tss at dovecot.org
Fri Oct 13 19:42:53 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv31346

Modified Files:
	mail-index-private.h mail-index.c 
Log Message:
Handle moving to memory failures better so we won't crash in some
situations.



Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- mail-index-private.h	11 Jul 2006 16:02:42 -0000	1.73
+++ mail-index-private.h	13 Oct 2006 18:42:50 -0000	1.74
@@ -27,7 +27,7 @@
 	((index)->dir == NULL)
 
 #define MAIL_INDEX_MAP_IS_IN_MEMORY(map) \
-	((map) != NULL && (map)->buffer != NULL)
+	((map)->buffer != NULL)
 
 #define MAIL_INDEX_MAP_IDX(map, idx) \
 	((struct mail_index_record *) \

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -d -r1.242 -r1.243
--- mail-index.c	17 Sep 2006 18:34:15 -0000	1.242
+++ mail-index.c	13 Oct 2006 18:42:50 -0000	1.243
@@ -1797,9 +1797,6 @@
 	if (MAIL_INDEX_IS_IN_MEMORY(index))
 		return 0;
 
-	/* set the index as being into memory */
-	i_free_and_null(index->dir);
-
 	if (index->map == NULL) {
 		/* mbox file was never even opened. just mark it as being in
 		   memory and let the caller re-open the index. */
@@ -1807,6 +1804,9 @@
 		return -1;
 	}
 
+	/* set the index as being into memory */
+	i_free_and_null(index->dir);
+
 	/* move index map to memory */
 	map = mail_index_map_clone(index->map, index->map->hdr.record_size);
 	mail_index_unmap(index, &index->map);
@@ -1833,7 +1833,7 @@
 
 	mail_index_set_inconsistent(index);
 
-	if (index->readonly)
+	if (index->readonly || index->map == NULL)
 		return;
 
 	hdr = *index->hdr;



More information about the dovecot-cvs mailing list