dovecot-2.2: liblib: If parent ostream closes itself on error, c...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Oct 11 19:18:48 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/ff2452560ef0
changeset: 16843:ff2452560ef0
user: Timo Sirainen <tss at iki.fi>
date: Fri Oct 11 19:17:10 2013 +0300
description:
liblib: If parent ostream closes itself on error, close our ostream as well.
This avoids a situation where ostream is basically unusable with
last_failed_errno set, but it's not marked as closed. The current code
often checks ostream->closed but doesn't check last_failed_errno.
ostream-file also autocloses the stream, but filter ostreams without this
patch don't autoclose, so this caused problems with e.g. IMAP COMPRESSION
extension where the zlib-ostream didn't get marked as closed, although the
problem was only logging "BUG: Unknown internal error" instead of
"Disconnected" as the client's disconnect reason.
diffstat:
src/lib/ostream.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r ab341f7509b5 -r ff2452560ef0 src/lib/ostream.c
--- a/src/lib/ostream.c Fri Oct 11 18:54:36 2013 +0300
+++ b/src/lib/ostream.c Fri Oct 11 19:17:10 2013 +0300
@@ -45,8 +45,10 @@
static void o_stream_close_full(struct ostream *stream, bool close_parents)
{
- io_stream_close(&stream->real_stream->iostream, close_parents);
- stream->closed = TRUE;
+ if (!stream->closed) {
+ io_stream_close(&stream->real_stream->iostream, close_parents);
+ stream->closed = TRUE;
+ }
if (stream->stream_errno == 0)
stream->stream_errno = EPIPE;
@@ -428,6 +430,8 @@
dest->stream_errno = src->stream_errno;
dest->last_failed_errno = src->last_failed_errno;
dest->overflow = src->overflow;
+ if (src->closed)
+ o_stream_close(dest);
}
static int o_stream_default_flush(struct ostream_private *_stream)
More information about the dovecot-cvs
mailing list