dovecot-2.2: lib-storage: mailbox_save_finish() internally does ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 17 16:20:36 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/8a07a5f6fd54
changeset: 16294:8a07a5f6fd54
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 17 16:19:42 2013 +0300
description:
lib-storage: mailbox_save_finish() internally does one final mailbox_save_continue()

diffstat:

 src/imap/cmd-append.c          |   3 ---
 src/lib-storage/mail-storage.c |  10 ++++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 7f00331058ef -r 8a07a5f6fd54 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Wed Apr 17 16:08:26 2013 +0300
+++ b/src/imap/cmd-append.c	Wed Apr 17 16:19:42 2013 +0300
@@ -342,9 +342,6 @@
 		if (ctx->save_ctx != NULL)
 			mailbox_save_cancel(&ctx->save_ctx);
 	} else {
-		/* do mailbox_save_continue() once more after appending EOF,
-		   to finish any pending reads */
-		(void)mailbox_save_continue(ctx->save_ctx);
 		if (mailbox_save_finish(&ctx->save_ctx) < 0) {
 			client_send_storage_error(cmd, ctx->storage);
 			ctx->failed = TRUE;
diff -r 7f00331058ef -r 8a07a5f6fd54 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Wed Apr 17 16:08:26 2013 +0300
+++ b/src/lib-storage/mail-storage.c	Wed Apr 17 16:19:42 2013 +0300
@@ -2018,7 +2018,17 @@
 	bool copying_via_save = ctx->copying_via_save;
 	int ret;
 
+	/* Do one final continue. The caller may not have done it if the
+	   input stream's offset already matched the number of bytes that
+	   were wanted to be saved. But due to nested istreams some of the
+	   underlying ones may not have seen the EOF yet, and haven't flushed
+	   out the pending data. */
+	if (mailbox_save_continue(ctx) < 0) {
+		mailbox_save_cancel(_ctx);
+		return -1;
+	}
 	*_ctx = NULL;
+
 	ret = t->box->v.save_finish(ctx);
 	if (ret == 0 && !copying_via_save) {
 		if (pvt_flags != 0)


More information about the dovecot-cvs mailing list