From: Stephan Bosch Date: Tue, 26 Sep 2023 00:06:23 +0000 (+0200) Subject: lib: istream - Simplify i_stream_read_data() EOF and error handling X-Git-Tag: 2.4.0~2409 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90a6fcf25e380b09be61a3ae78705f511aa549fa;p=thirdparty%2Fdovecot%2Fcore.git lib: istream - Simplify i_stream_read_data() EOF and error handling --- diff --git a/src/lib/istream.c b/src/lib/istream.c index 073662fdd6..168456f01f 100644 --- a/src/lib/istream.c +++ b/src/lib/istream.c @@ -797,13 +797,9 @@ int i_stream_read_data(struct istream *stream, const unsigned char **data_r, i_assert(!stream->blocking); return 0; } - if (stream->eof) { - if (read_more) { - /* we read at least some new data */ - return 0; - } - } else { - i_assert(stream->stream_errno != 0); + if (stream->stream_errno == 0 && read_more) { + /* we read at least some new data */ + return 0; } return -1; }