It's now possible to call o_stream_flush() without the trailer getting
written.
It's also now required to call o_stream_finish() to write the trailer before
closing the ostream. This guarantees that the caller checks that the
trailer was successfully written. This isn't needed if the ostream already
failed before writing the trailer.
{
struct zlib_ostream *zstream = (struct zlib_ostream *)stream;
- (void)o_stream_flush(&zstream->ostream.ostream);
+ i_assert(zstream->ostream.finished ||
+ zstream->ostream.ostream.stream_errno != 0);
(void)deflateEnd(&zstream->zs);
if (close_parent)
o_stream_close(zstream->ostream.parent);
struct zlib_ostream *zstream = (struct zlib_ostream *)stream;
int ret;
- if (o_stream_zlib_send_flush(zstream, TRUE) < 0)
+ if (o_stream_zlib_send_flush(zstream, stream->finished) < 0)
return -1;
ret = o_stream_flush(stream->parent);
test_assert(o_stream_send(output, buf, sizeof(buf)) == sizeof(buf));
}
+ test_assert(o_stream_finish(output) > 0);
o_stream_destroy(&output);
o_stream_destroy(&file_output);
sha1_result(&sha1, output_sha1);