[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-save.c, 1.10.2.5, 1.10.2.6

cras at dovecot.org cras at dovecot.org
Mon Jul 24 01:40:55 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv23526

Modified Files:
      Tag: branch_1_0
	dbox-save.c 
Log Message:
When saving a mail with initial keywords, lock the uidlist before doing
anything with the file's header.



Index: dbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-save.c,v
retrieving revision 1.10.2.5
retrieving revision 1.10.2.6
diff -u -d -r1.10.2.5 -r1.10.2.6
--- dbox-save.c	23 Jul 2006 15:37:55 -0000	1.10.2.5
+++ dbox-save.c	23 Jul 2006 22:40:53 -0000	1.10.2.6
@@ -152,6 +152,18 @@
 
 	t_push();
 	if (keywords != NULL && keywords->count > 0) {
+		uint32_t uid;
+		time_t mtime;
+
+		/* uidlist must be locked while we're reading or modifying
+		   file's header */
+		if (dbox_uidlist_append_get_first_uid(ctx->append_ctx,
+						      &uid, &mtime) < 0) {
+			ctx->failed = TRUE;
+			t_pop();
+			return -1;
+		}
+
 		/* write keywords to the file */
 		file_keywords = buffer_create_dynamic(pool_datastack_create(),
 						      DBOX_KEYWORD_COUNT);



More information about the dovecot-cvs mailing list