Mercurial > dovecot > core-2.2
changeset 20534:cffb60b15b6e
lib-dcrypt: Allow flushing ostream multiple times.
The first time flushes the encryption and the following times just flush the
parent stream.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 11 Jul 2016 20:27:48 +0300 |
parents | 5b1137b457a2 |
children | 82f11b614b99 |
files | src/lib-dcrypt/ostream-encrypt.c |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-dcrypt/ostream-encrypt.c Mon Jul 11 20:27:14 2016 +0300 +++ b/src/lib-dcrypt/ostream-encrypt.c Mon Jul 11 20:27:48 2016 +0300 @@ -492,7 +492,11 @@ /* 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 */