dovecot-2.0: maildir: If saving fails, revert also changes to in...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 4 21:35:31 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/5f2bcf817c94
changeset: 9720:5f2bcf817c94
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 03 15:23:14 2009 -0400
description:
maildir: If saving fails, revert also changes to indexes.
Fixes a crash in that situation.

diffstat:

1 file changed, 8 insertions(+)
src/lib-storage/index/maildir/maildir-save.c |    8 ++++++++

diffs (19 lines):

diff -r 810a70b696fc -r 5f2bcf817c94 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c	Mon Aug 03 15:20:11 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-save.c	Mon Aug 03 15:23:14 2009 -0400
@@ -468,7 +468,15 @@ static int maildir_save_finish_received_
 
 static void maildir_save_remove_last_filename(struct maildir_save_context *ctx)
 {
+	struct index_transaction_context *t =
+		(struct index_transaction_context *)ctx->ctx.transaction;
 	struct maildir_filename **fm;
+
+	mail_index_expunge(ctx->trans, ctx->seq);
+	/* currently we can't just drop pending cache updates for this one
+	   specific record, so we'll reset the whole cache transaction. */
+	mail_cache_transaction_reset(t->cache_trans);
+	ctx->seq--;
 
 	for (fm = &ctx->files; (*fm)->next != NULL; fm = &(*fm)->next) ;
 	i_assert(*fm == ctx->file_last);


More information about the dovecot-cvs mailing list