[dovecot-cvs] dovecot/src/lib-index mail-cache.c,1.19,1.20

cras at procontrol.fi cras at procontrol.fi
Tue Oct 21 15:10:07 EEST 2003


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

Modified Files:
	mail-cache.c 
Log Message:
header fix



Index: mail-cache.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-cache.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mail-cache.c	21 Oct 2003 03:35:32 -0000	1.19
+++ mail-cache.c	21 Oct 2003 11:10:05 -0000	1.20
@@ -787,6 +787,7 @@
 
 	/* headers could have changed, reread them */
 	memset(cache->split_offsets, 0, sizeof(cache->split_offsets));
+	memset(cache->split_headers, 0, sizeof(cache->split_headers));
 
 	if (ret) {
 		cache->index->header->flags &=
@@ -1363,7 +1364,7 @@
 {
 	struct mail_cache *cache = ctx->cache;
 	uint32_t offset, update_offset, size;
-	const char *header_str;
+	const char *header_str, *prev_str;
 
 	i_assert(*headers != NULL);
 	i_assert(idx < MAIL_CACHE_HEADERS_COUNT);
@@ -1373,9 +1374,13 @@
 	t_push();
 
 	header_str = write_header_string(headers, &size);
-	i_assert(idx == 0 ||
-		 strcmp(mail_cache_get_header_fields_str(cache, idx-1),
-			header_str) != 0);
+	if (idx != 0) {
+		prev_str = mail_cache_get_header_fields_str(cache, idx-1);
+		if (prev_str == NULL)
+			return FALSE;
+
+		i_assert(strcmp(header_str, prev_str) != 0);
+	}
 
 	offset = mail_cache_append_space(ctx, size + sizeof(uint32_t));
 	if (offset != 0) {



More information about the dovecot-cvs mailing list