# HG changeset patch # User Stephan Bosch # Date 1518193468 -3600 # Node ID f2d74b6dd7540f82065b8cbc14fead37eea51556 # Parent bf1a68547d67e048b5e4911c9e2cdb7a9b156783 lib-ssl-iostream: ostream-openssl: Fix behavior of o_stream_flush() so that 1 is only returned when buffer is empty. diff -r bf1a68547d67 -r f2d74b6dd754 src/lib-ssl-iostream/ostream-openssl.c --- 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