[dovecot-cvs] dovecot-1.0: Don't crash if saving runs out of disk space while ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 12 16:59:46 EEST 2007


details:   http://hg.dovecot.org/dovecot-1.0/rev/fe4a89b2a548
changeset: 5296:fe4a89b2a548
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 12 16:59:42 2007 +0300
description:
Don't crash if saving runs out of disk space while in the middle of moving
multiple files to new/ or cur/ directories and the already moved files had
keywords.

diffstat:

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

diffs (32 lines):

diff -r ceb6f164d753 -r fe4a89b2a548 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c	Tue Jun 12 16:37:27 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-save.c	Tue Jun 12 16:59:42 2007 +0300
@@ -20,6 +20,7 @@ struct maildir_filename {
 struct maildir_filename {
 	struct maildir_filename *next;
 	const char *basename;
+	const char *saved_dest_fname; /* only if it had keywords */
 
 	uoff_t size;
 	enum mail_flags flags;
@@ -240,12 +241,20 @@ maildir_get_updated_filename(struct mail
 		return FALSE;
 	}
 
+	/* If we're unlinking already copied files, ctx->sync_ctx could be
+	   NULL by now. So we use the saved filename if it exists. */
+	if (mf->saved_dest_fname != NULL) {
+		*fname_r = mf->saved_dest_fname;
+		return FALSE;
+	}
+
 	buffer_update_const_data(ctx->keywords_buffer, mf + 1,
 				 mf->keywords_count * sizeof(unsigned int));
 	*fname_r = maildir_filename_set_flags(
 			maildir_sync_get_keywords_sync_ctx(ctx->sync_ctx),
 			basename, mf->flags & MAIL_FLAGS_MASK,
 			&ctx->keywords_array);
+	mf->saved_dest_fname = p_strdup(ctx->pool, *fname_r);
 	return FALSE;
 }
 


More information about the dovecot-cvs mailing list