[dovecot-cvs] dovecot/src/lib-index mail-index-file.c,1.2,1.3 mail-index.c,1.97,1.98

cras at procontrol.fi cras at procontrol.fi
Sun Aug 24 10:32:10 EEST 2003


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv14418

Modified Files:
	mail-index-file.c mail-index.c 
Log Message:
expunge/append behaviour corrupted indexes



Index: mail-index-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-file.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mail-index-file.c	11 Aug 2003 02:40:40 -0000	1.2
+++ mail-index-file.c	24 Aug 2003 06:32:08 -0000	1.3
@@ -31,6 +31,11 @@
 	index->header->used_file_size -= sizeof(*rec) * count;
 	index->mmap_used_length -= sizeof(*rec) * count;
 
+	/* not really needed since append() will initialize it as well,
+	   but may help preventing problems if change is only partially
+	   written to disk */
+	memset((char *) rec + index->mmap_used_length, 0, sizeof(*rec) * count);
+
 	return mail_index_truncate(index);
 }
 

Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- mail-index.c	11 Aug 2003 02:40:40 -0000	1.97
+++ mail-index.c	24 Aug 2003 06:32:08 -0000	1.98
@@ -680,6 +680,7 @@
 					    index->mmap_used_length);
 	rec->uid = index->header->next_uid++;
 	rec->msg_flags = 0;
+	rec->cache_offset = 0;
 
 	index->header->used_file_size += sizeof(*rec);
 	index->mmap_used_length += sizeof(*rec);



More information about the dovecot-cvs mailing list