Skip to content

Commit

Permalink
lib-ssl-iostream: ostream-openssl: Fix behavior of o_stream_flush() s…
Browse files Browse the repository at this point in the history
…o that 1 is only returned when buffer is empty.
  • Loading branch information
stephanbosch authored and villesavolainen committed Mar 12, 2018
1 parent 7b652dc commit 6d4e1c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib-ssl-iostream/ostream-openssl.c
Expand Up @@ -138,7 +138,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
Expand Down

0 comments on commit 6d4e1c7

Please sign in to comment.