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

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 12 05:44:52 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/57c735865b19
changeset: 14124:57c735865b19
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 12 05:44:13 2012 +0200
description:
dsync: Don't assert-crash if saving a message fails.

diffstat:

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

diffs (29 lines):

diff -r 9b70d164e974 -r 57c735865b19 src/doveadm/dsync/dsync-worker-local.c
--- a/src/doveadm/dsync/dsync-worker-local.c	Sun Feb 12 05:35:54 2012 +0200
+++ b/src/doveadm/dsync/dsync-worker-local.c	Sun Feb 12 05:44:13 2012 +0200
@@ -1627,10 +1627,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)
@@ -1651,6 +1655,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