dovecot: Don't give "Newly added field got lost unexpectedly" er...

dovecot at dovecot.org dovecot at dovecot.org
Sun Oct 21 15:39:46 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/0e46072f797a
changeset: 6589:0e46072f797a
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Oct 21 15:39:42 2007 +0300
description:
Don't give "Newly added field got lost unexpectedly" errors when cache file
is created while adding a new field.

diffstat:

1 file changed, 4 insertions(+), 3 deletions(-)
src/lib-index/mail-cache-transaction.c |    7 ++++---

diffs (24 lines):

diff -r fd01ec16611f -r 0e46072f797a src/lib-index/mail-cache-transaction.c
--- a/src/lib-index/mail-cache-transaction.c	Sun Oct 21 15:28:53 2007 +0300
+++ b/src/lib-index/mail-cache-transaction.c	Sun Oct 21 15:39:42 2007 +0300
@@ -722,9 +722,6 @@ static int mail_cache_header_add_field(s
 	buffer_t *buffer;
 	int ret;
 
-	cache->fields[field_idx].last_used = ioloop_time;
-	cache->fields[field_idx].used = TRUE;
-
 	if ((ret = mail_cache_transaction_lock(ctx)) <= 0) {
 		/* create the cache file if it doesn't exist yet */
 		if (ctx->tried_compression)
@@ -742,6 +739,10 @@ static int mail_cache_header_add_field(s
 		(void)mail_cache_unlock(cache);
 		return -1;
 	}
+
+	/* update these only after reading */
+	cache->fields[field_idx].last_used = ioloop_time;
+	cache->fields[field_idx].used = TRUE;
 
 	if (cache->field_file_map[field_idx] != (uint32_t)-1) {
 		/* it was already added */


More information about the dovecot-cvs mailing list