From: Timo Sirainen Date: Mon, 9 Jul 2018 14:41:57 +0000 (+0300) Subject: mbox: Fix ostream error handling in mbox_move() X-Git-Tag: 2.4.0~1454 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40eaff4900264cd98e309d72c7cd7ea7d97b8d0e;p=thirdparty%2Fdovecot%2Fcore.git mbox: Fix ostream error handling in mbox_move() o_stream_nsend_send_istream() needs to be followed by o_stream_flush(). It also detects the istream error. --- diff --git a/src/lib-storage/index/mbox/mbox-sync-rewrite.c b/src/lib-storage/index/mbox/mbox-sync-rewrite.c index eeb4878e90..fbda9af107 100644 --- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c +++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c @@ -41,12 +41,7 @@ int mbox_move(struct mbox_sync_context *sync_ctx, this point or we're corrupted. */ input = i_stream_create_limit(sync_ctx->file_input, size); o_stream_nsend_istream(output, input); - if (input->stream_errno != 0) { - mailbox_set_critical(&mbox->box, - "read() failed with mbox: %s", - i_stream_get_error(input)); - ret = -1; - } else if (output->stream_errno != 0) { + if (o_stream_flush(output) < 0) { mailbox_set_critical(&mbox->box, "write() failed with mbox: %s", o_stream_get_error(output));