dovecot-2.0: dsync: Don't assert-crash if saving a message fails.

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 12 05:45:09 EET 2012


details:   http://hg.dovecot.org/dovecot-2.0/rev/eed2b8fb2a52
changeset: 13052:eed2b8fb2a52
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 12 05:45:04 2012 +0200
description:
dsync: Don't assert-crash if saving a message fails.

diffstat:

 src/dsync/dsync-worker-local.c |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (29 lines):

diff -r 71dbe30caedb -r eed2b8fb2a52 src/dsync/dsync-worker-local.c
--- a/src/dsync/dsync-worker-local.c	Sun Feb 12 03:47:01 2012 +0200
+++ b/src/dsync/dsync-worker-local.c	Sun Feb 12 05:45:04 2012 +0200
@@ -1681,10 +1681,14 @@
 	struct mailbox *dest_box = worker->ext_mail->box;
 	dsync_worker_save_callback_t *callback;
 	ssize_t ret;
+	bool save_failed = FALSE;
 
 	while ((ret = i_stream_read(worker->save_input)) > 0 || ret == -2) {
-		if (mailbox_save_continue(worker->save_ctx) < 0)
+		if (mailbox_save_continue(worker->save_ctx) < 0) {
+			save_failed = TRUE;
+			ret = -1;
 			break;
+		}
 	}
 	if (ret == 0) {
 		if (worker->save_io != NULL)
@@ -1705,6 +1709,9 @@
 		i_error("read(msg input) failed: %m");
 		mailbox_save_cancel(&worker->save_ctx);
 		dsync_worker_set_failure(&worker->worker);
+	} else if (save_failed) {
+		mailbox_save_cancel(&worker->save_ctx);
+		dsync_worker_set_failure(&worker->worker);
 	} else {
 		i_assert(worker->save_input->eof);
 		if (mailbox_save_finish(&worker->save_ctx) < 0) {


More information about the dovecot-cvs mailing list