]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ssl-iostream: ostream-openssl: Fix behavior of o_stream_flush() so that 1 is...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 9 Feb 2018 16:24:28 +0000 (17:24 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 16 Feb 2018 12:54:55 +0000 (13:54 +0100)
src/lib-ssl-iostream/ostream-openssl.c

index 34611b3a8f05d702d94169ebbddbd8a035e87797..c475094bdccf572f6f9ac7e672b95a2e32322b80 100644 (file)
@@ -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