[dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.69.2.1, 1.69.2.2 mail-index.c, 1.230.2.6, 1.230.2.7
tss at dovecot.org
tss at dovecot.org
Fri Oct 13 19:42:50 UTC 2006
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv31351
Modified Files:
Tag: branch_1_0
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.69.2.1
retrieving revision 1.69.2.2
diff -u -d -r1.69.2.1 -r1.69.2.2
--- mail-index-private.h 28 May 2006 21:18:27 -0000 1.69.2.1
+++ mail-index-private.h 13 Oct 2006 18:42:48 -0000 1.69.2.2
@@ -25,7 +25,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.230.2.6
retrieving revision 1.230.2.7
diff -u -d -r1.230.2.6 -r1.230.2.7
--- mail-index.c 23 Jul 2006 14:22:58 -0000 1.230.2.6
+++ mail-index.c 13 Oct 2006 18:42:48 -0000 1.230.2.7
@@ -1795,9 +1795,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. */
@@ -1805,6 +1802,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);
@@ -1831,7 +1831,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