From: Timo Sirainen Date: Mon, 11 Jul 2016 17:27:48 +0000 (+0300) Subject: lib-dcrypt: Allow flushing ostream multiple times. X-Git-Tag: 2.2.26~467 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fdb1b596168c7ab3d4dd56c2b19f3f891cde13a6;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: Allow flushing ostream multiple times. The first time flushes the encryption and the following times just flush the parent stream. --- diff --git a/src/lib-dcrypt/ostream-encrypt.c b/src/lib-dcrypt/ostream-encrypt.c index a18fc2bc38..aca819eb93 100644 --- a/src/lib-dcrypt/ostream-encrypt.c +++ b/src/lib-dcrypt/ostream-encrypt.c @@ -492,7 +492,11 @@ int o_stream_encrypt_flush(struct ostream_private *stream) /* if nothing was written, we are done */ if (!estream->prefix_written) return o_stream_flush(stream->parent); - i_assert(!estream->finalized); + if (estream->finalized) { + /* we've already flushed the encrypted output. + just flush the parent. */ + return o_stream_flush(stream->parent); + } estream->finalized = TRUE; /* acquire last block */