[dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.39, 1.40 mail-index-sync-update.c, 1.66, 1.67 mail-index.c, 1.172, 1.173

cras at dovecot.org cras at dovecot.org
Mon Nov 29 20:01:28 EET 2004


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

Modified Files:
	mail-index-private.h mail-index-sync-update.c mail-index.c 
Log Message:
Wrong extension sync_handler might have been called if index extensions
didn't match current map's extensions.



Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- mail-index-private.h	29 Nov 2004 00:48:45 -0000	1.39
+++ mail-index-private.h	29 Nov 2004 18:01:26 -0000	1.40
@@ -40,6 +40,7 @@
 
 struct mail_index_ext {
 	const char *name;
+	uint32_t index_idx; /* index ext_id */
 	uint32_t reset_id;
 	uint32_t hdr_offset;
 	uint32_t hdr_size;

Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- mail-index-sync-update.c	29 Nov 2004 17:35:45 -0000	1.66
+++ mail-index-sync-update.c	29 Nov 2004 18:01:26 -0000	1.67
@@ -785,9 +785,8 @@
 	rec = MAIL_INDEX_MAP_IDX(view->map, seq-1);
 	old_data = PTR_OFFSET(rec, ext->record_offset);
 
-	/* @UNSAFE */
 	sync_handlers = view->index->sync_handlers->data;
-	sync_handlers += ctx->cur_ext_id;
+	sync_handlers += ext->index_idx;
 
 	/* call sync handlers only when we're syncing index (not view) */
 	if ((sync_handlers->type & ctx->type) != 0) {
@@ -797,6 +796,7 @@
 			return ret;
 	}
 
+	/* @UNSAFE */
 	memcpy(old_data, u + 1, ext->record_size);
 	return 1;
 }

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- mail-index.c	29 Nov 2004 01:16:30 -0000	1.172
+++ mail-index.c	29 Nov 2004 18:01:26 -0000	1.173
@@ -81,6 +81,7 @@
 
 	memset(&ext, 0, sizeof(ext));
 	ext.name = p_strdup(index->extension_pool, name);
+	ext.index_idx = ext_count;
 	ext.hdr_size = default_hdr_size;
 	ext.record_size = default_record_size;
 	ext.record_align = default_record_align;
@@ -181,6 +182,8 @@
 
 	ext_id = mail_index_ext_register(index, name, hdr_size,
 					 record_size, record_align);
+	ext->index_idx = ext_id;
+
 	while (map->ext_id_map->used < ext_id * sizeof(uint32_t))
 		buffer_append(map->ext_id_map, &empty_id, sizeof(empty_id));
 	buffer_write(map->ext_id_map, ext_id * sizeof(uint32_t),



More information about the dovecot-cvs mailing list