]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm-save: Check stream errno before save
authorAki Tuomi <aki.tuomi@dovecot.fi>
Thu, 3 Nov 2016 13:30:58 +0000 (15:30 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 16 Nov 2016 10:24:29 +0000 (12:24 +0200)
This is to ensure the file has been really opened.

src/doveadm/doveadm-mail-save.c

index 6208e8b988d5a7dbfcf8848ac5755c7a7efcb115..66f3a5071c2c63fe17747146c726cfd967ba3e27 100644 (file)
@@ -20,6 +20,13 @@ cmd_save_to_mailbox(struct save_cmd_context *ctx, struct mailbox *box,
        ssize_t ret;
        bool save_failed = FALSE;
 
+       if (input->stream_errno != 0) {
+               i_error("open(%s) failed: %s",
+                       i_stream_get_name(input),
+                       i_stream_get_error(input));
+               return -1;
+       }
+
        if (mailbox_open(box) < 0) {
                i_error("Failed to open mailbox %s: %s",
                        mailbox_get_vname(box), mailbox_get_last_error(box, NULL));