From: Stephan Bosch Date: Wed, 25 Jan 2023 17:39:44 +0000 (+0100) Subject: lib: ostream-wrapper - Call output_finished() callback when wrapper stream is finishe... X-Git-Tag: 2.4.0~3037 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70f61ef2a91f19ab898869fcdfd3f3dca85cea17;p=thirdparty%2Fdovecot%2Fcore.git lib: ostream-wrapper - Call output_finished() callback when wrapper stream is finished and empty. Before, it would only be called when the parent output is also fully flushed, which is too late. --- diff --git a/src/lib/ostream-wrapper.c b/src/lib/ostream-wrapper.c index dfd669946f..79d2ccb3c1 100644 --- a/src/lib/ostream-wrapper.c +++ b/src/lib/ostream-wrapper.c @@ -922,9 +922,9 @@ static int wrapper_ostream_flush(struct ostream_private *stream) } } while (ret == 0 && stream->ostream.blocking); - if (ret > 0 && stream->finished) { + if (stream->finished && ret >= 0 && + wrapper_ostream_is_empty(wostream)) { /* This was an o_stream_finish() call or subsequent flush */ - i_assert(wrapper_ostream_is_empty(wostream)); while ((ret = wrapper_ostream_finish(wostream)) == 0) { if (!stream->ostream.blocking) { /* Not yet finished completely */