]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Fix ostream error handling in mbox_move()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 9 Jul 2018 14:41:57 +0000 (17:41 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 23 Sep 2024 14:12:42 +0000 (14:12 +0000)
o_stream_nsend_send_istream() needs to be followed by o_stream_flush().
It also detects the istream error.

src/lib-storage/index/mbox/mbox-sync-rewrite.c

index eeb4878e907f573ccf544d0db4ebb82f43511683..fbda9af10793121cf67f9b4a65020a8e260110fb 100644 (file)
@@ -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));