]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: istream-attachment-extractor - use EIO for internal errors
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 23 Dec 2016 17:59:13 +0000 (12:59 -0500)
committerGitLab <gitlab@git.dovecot.net>
Fri, 23 Dec 2016 18:48:47 +0000 (20:48 +0200)
These happen only if the attachment writing failed for some reason.
The input stream itself can't have any errors, so EINVAL isn't proper.

src/lib-mail/istream-attachment-extractor.c

index fb831ca116b84fa0337f0d73ce5cb042be98f943..9251b926988a331e07c2ad9bf5a1ebdc9f1f67ba 100644 (file)
@@ -613,7 +613,7 @@ static int astream_read_next(struct attachment_istream *astream, bool *retry_r)
 
                if (ret < 0) {
                        io_stream_set_error(&stream->iostream, "%s", error);
-                       stream->istream.stream_errno = EINVAL;
+                       stream->istream.stream_errno = EIO;
                }
                astream->cur_part = NULL;
                return -1;
@@ -628,7 +628,7 @@ static int astream_read_next(struct attachment_istream *astream, bool *retry_r)
                /* end of a MIME part */
                if (astream_end_of_part(astream, &error) < 0) {
                        io_stream_set_error(&stream->iostream, "%s", error);
-                       stream->istream.stream_errno = EINVAL;
+                       stream->istream.stream_errno = EIO;
                        return -1;
                }
        }