[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c,1.14,1.15

cras at procontrol.fi cras at procontrol.fi
Tue Oct 21 07:14:47 EEST 2003


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

Modified Files:
	index-mail-headers.c 
Log Message:
Some cleanups and extra checks to detect if header names list gets
duplicated (can happen, why?..)



Index: index-mail-headers.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- index-mail-headers.c	6 Oct 2003 23:23:37 -0000	1.14
+++ index-mail-headers.c	21 Oct 2003 03:14:44 -0000	1.15
@@ -147,6 +147,7 @@
 	if (wanted_headers == NULL || *wanted_headers == NULL)
 		return -1;
 
+	t_push();
 	wanted_headers = sort_array(wanted_headers);
 
 	ret = -1;
@@ -167,11 +168,12 @@
 		}
 
 		if (*tmp != NULL)
-			return ret;
+			break;
 
 		/* find the minimum matching header number */
 		ret = i;
 	}
+	t_pop();
 
 	return ret;
 }
@@ -756,7 +758,11 @@
 	idx = find_wanted_headers(mail->ibox->index->cache, headers);
 	if (idx >= 0) {
 		/* all headers found */
-                i_assert(idx == mail->data.header_save_idx);
+		if (idx != mail->data.header_save_idx) {
+			mail_cache_set_corrupted(mail->ibox->index->cache,
+				"Duplicated header names list (%d and %d)",
+				idx, mail->data.header_save_idx);
+		}
 	} else {
 		/* there's some new headers */
 		idx = find_unused_header_idx(mail->ibox->index->cache);



More information about the dovecot-cvs mailing list