dovecot: Last change caused assert-crashes.

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 6 18:09:03 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/faa4da358d37
changeset: 6699:faa4da358d37
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 06 18:08:58 2007 +0200
description:
Last change caused assert-crashes.

diffstat:

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

diffs (22 lines):

diff -r 76cf2e548c6d -r faa4da358d37 src/lib-index/mail-cache-transaction.c
--- a/src/lib-index/mail-cache-transaction.c	Mon Nov 05 21:51:18 2007 +0200
+++ b/src/lib-index/mail-cache-transaction.c	Tue Nov 06 18:08:58 2007 +0200
@@ -732,9 +732,15 @@ static int mail_cache_header_add_field(s
 		if (mail_cache_compress(cache, ctx->trans) < 0)
 			return -1;
 
-		/* compression should have added it */
-		i_assert(cache->field_file_map[field_idx] != (uint32_t)-1);
-		return 0;
+		/* if we compressed the cache, the field should be there now.
+		   it's however possible that someone else just compressed it
+		   and we only reopened the cache file. */
+		if (cache->field_file_map[field_idx] != (uint32_t)-1)
+			return 0;
+
+		/* need to add it */
+		if ((ret = mail_cache_transaction_lock(ctx)) <= 0)
+			return -1;
 	}
 
 	/* re-read header to make sure we don't lose any fields. */


More information about the dovecot-cvs mailing list