Mercurial > dovecot > core-2.2
changeset 22843:f2d74b6dd754
lib-ssl-iostream: ostream-openssl: Fix behavior of o_stream_flush() so that 1 is only returned when buffer is empty.
author | Stephan Bosch <stephan.bosch@dovecot.fi> |
---|---|
date | Fri, 09 Feb 2018 17:24:28 +0100 |
parents | bf1a68547d67 |
children | 159000ec40a0 |
files | src/lib-ssl-iostream/ostream-openssl.c |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-ssl-iostream/ostream-openssl.c Thu Feb 15 15:47:48 2018 +0100 +++ b/src/lib-ssl-iostream/ostream-openssl.c Fri Feb 09 17:24:28 2018 +0100 @@ -137,7 +137,13 @@ 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