[dovecot-cvs] dovecot/src/lib-index mail-index-sync-keywords.c, 1.10, 1.11 mail-index-sync-update.c, 1.102, 1.103

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


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

Modified Files:
	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.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mail-index-sync-keywords.c	30 May 2006 08:31:20 -0000	1.10
+++ mail-index-sync-keywords.c	23 Jul 2006 21:41:38 -0000	1.11
@@ -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.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- mail-index-sync-update.c	23 Jul 2006 17:32:43 -0000	1.102
+++ mail-index-sync-update.c	23 Jul 2006 21:41:38 -0000	1.103
@@ -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