From: Stephan Bosch Date: Fri, 9 Feb 2018 16:24:28 +0000 (+0100) Subject: lib-ssl-iostream: ostream-openssl: Fix behavior of o_stream_flush() so that 1 is... X-Git-Tag: 2.2.35~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d67676e4fcb44b9411937472e1e409eefa58950;p=thirdparty%2Fdovecot%2Fcore.git lib-ssl-iostream: ostream-openssl: Fix behavior of o_stream_flush() so that 1 is only returned when buffer is empty. --- diff --git a/src/lib-ssl-iostream/ostream-openssl.c b/src/lib-ssl-iostream/ostream-openssl.c index 34611b3a8f..c475094bdc 100644 --- a/src/lib-ssl-iostream/ostream-openssl.c +++ b/src/lib-ssl-iostream/ostream-openssl.c @@ -137,7 +137,13 @@ static int o_stream_ssl_flush(struct ostream_private *stream) sstream->ssl_io->ostream_flush_waiting_input = TRUE; ret = 1; } - return ret; + + if (ret <= 0) + return ret; + + /* return 1 only when the output buffer is empty, which is what the + caller expects. */ + return o_stream_get_buffer_used_size(plain_output) == 0 ? 1 : 0; } static ssize_t