[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.133,1.134

cras at procontrol.fi cras at procontrol.fi
Sun Jun 20 07:23:18 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv2239/lib-index

Modified Files:
	mail-index.c 
Log Message:
assertfix



Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- mail-index.c	19 Jun 2004 17:41:30 -0000	1.133
+++ mail-index.c	20 Jun 2004 04:23:16 -0000	1.134
@@ -199,7 +199,13 @@
 	const struct mail_index_header *hdr;
 	unsigned int records_count;
 
-	i_assert(map->buffer == NULL);
+	i_assert(!map->write_to_disk);
+
+	if (map->buffer != NULL) {
+		/* we had temporarily used a buffer, eg. for updating index */
+		buffer_free(map->buffer);
+		map->buffer = NULL;
+	}
 
 	map->mmap_base = index->lock_type != F_WRLCK ?
 		mmap_ro_file(index->fd, &map->mmap_size) :
@@ -352,6 +358,7 @@
 		/* FIXME: we need to re-read header */
 	} else if (map->mmap_base != NULL) {
 		/* see if re-mmaping is needed (file has grown) */
+		i_assert(map->buffer == NULL);
 		hdr = map->mmap_base;
 
 		/* always check corrupted-flag to avoid errors later */



More information about the dovecot-cvs mailing list