]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fixed assert-crash in o_stream_send_istream() if input stream was the one that...
authorTimo Sirainen <tss@iki.fi>
Thu, 9 Oct 2014 15:40:54 +0000 (18:40 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 9 Oct 2014 15:40:54 +0000 (18:40 +0300)
src/lib/ostream.c

index 4c34aed767d8e012fe313b64d8da90dd5496f256..3d69d88216c15711d561178e26e97502eefd8ec1 100644 (file)
@@ -329,9 +329,12 @@ off_t o_stream_send_istream(struct ostream *outstream,
        o_stream_clear_error(outstream);
        ret = _outstream->send_istream(_outstream, instream);
        if (unlikely(ret < 0)) {
-               i_assert(outstream->stream_errno != 0);
-               outstream->last_failed_errno = outstream->stream_errno;
-               errno = outstream->stream_errno;
+               if (outstream->stream_errno != 0) {
+                       outstream->last_failed_errno = outstream->stream_errno;
+                       errno = outstream->stream_errno;
+               } else {
+                       i_assert(instream->stream_errno != 0);
+               }
        }
        return ret;
 }