[dovecot-cvs] dovecot/src/lib-index mail-index-sync-keywords.c, 1.9.2.1, 1.9.2.2 mail-index-sync-update.c, 1.96.2.4, 1.96.2.5

cras at dovecot.org cras at dovecot.org
Mon Jul 24 00:41:39 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv6026

Modified Files:
      Tag: branch_1_0
	mail-index-sync-keywords.c mail-index-sync-update.c 
Log Message:
In some conditions a keyword could have been added to the index twice. Also
a few cleanups.



Index: mail-index-sync-keywords.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-keywords.c,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -d -r1.9.2.1 -r1.9.2.2
--- mail-index-sync-keywords.c	18 May 2006 10:08:55 -0000	1.9.2.1
+++ mail-index-sync-keywords.c	23 Jul 2006 21:41:37 -0000	1.9.2.2
@@ -20,9 +20,9 @@
 			return -1;
 		ctx->keywords_read = TRUE;
 	}
-	if (mail_index_keyword_lookup(ctx->view->index, keyword_name,
-				      FALSE, &keyword_idx) &&
-	    array_is_created(&map->keyword_idx_map)) {
+	if (array_is_created(&map->keyword_idx_map) &&
+	    mail_index_keyword_lookup(ctx->view->index, keyword_name,
+				      FALSE, &keyword_idx)) {
 		/* FIXME: slow. maybe create index -> file mapping as well */
 		idx_map = array_get(&map->keyword_idx_map, &count);
 		for (i = 0; i < count; i++) {
@@ -222,6 +222,8 @@
 	i_assert(data_offset < ext->record_size);
 	data_offset += ext->record_offset;
 
+	i_assert(data_offset >= sizeof(struct mail_index_record));
+
 	switch (type) {
 	case MODIFY_ADD:
 		for (seq1--; seq1 < seq2; seq1++) {
@@ -323,7 +325,6 @@
 	return 1;
 }
 
-
 int
 mail_index_sync_keywords_reset(struct mail_index_sync_map_ctx *ctx,
 			       const struct mail_transaction_header *hdr,

Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.96.2.4
retrieving revision 1.96.2.5
diff -u -d -r1.96.2.4 -r1.96.2.5
--- mail-index-sync-update.c	23 Jul 2006 17:32:42 -0000	1.96.2.4
+++ mail-index-sync-update.c	23 Jul 2006 21:41:37 -0000	1.96.2.5
@@ -21,6 +21,8 @@
 
 	/* if map still exists after this, it's only in views. */
 	view->map->write_to_disk = FALSE;
+	/* keywords aren't parsed for the new map yet */
+	ctx->keywords_read = FALSE;
 
 	mail_index_unmap(view->index, &view->map);
 	view->map = map;



More information about the dovecot-cvs mailing list