dovecot-2.0: zlib: Avoid assert-crashing if parent ostream's wri...

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 10 07:57:41 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/75daa638281b
changeset: 13000:75daa638281b
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 10 07:57:16 2011 +0200
description:
zlib: Avoid assert-crashing if parent ostream's write had failed earlier.

diffstat:

 src/plugins/zlib/ostream-bzlib.c |  7 ++++++-
 src/plugins/zlib/ostream-zlib.c  |  7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r af6d0858e64b -r 75daa638281b src/plugins/zlib/ostream-bzlib.c
--- a/src/plugins/zlib/ostream-bzlib.c	Fri Dec 09 18:57:53 2011 +0200
+++ b/src/plugins/zlib/ostream-bzlib.c	Sat Dec 10 07:57:16 2011 +0200
@@ -82,7 +82,12 @@
 	bool done = FALSE;
 	int ret;
 
-	i_assert(zs->avail_in == 0);
+	if (zs->avail_in != 0) {
+		i_assert(zstream->ostream.ostream.last_failed_errno != 0);
+		zstream->ostream.ostream.stream_errno =
+			zstream->ostream.ostream.last_failed_errno;
+		return -1;
+	}
 
 	if (zstream->flushed)
 		return 0;
diff -r af6d0858e64b -r 75daa638281b src/plugins/zlib/ostream-zlib.c
--- a/src/plugins/zlib/ostream-zlib.c	Fri Dec 09 18:57:53 2011 +0200
+++ b/src/plugins/zlib/ostream-zlib.c	Sat Dec 10 07:57:16 2011 +0200
@@ -141,7 +141,12 @@
 	bool done = FALSE;
 	int ret;
 
-	i_assert(zs->avail_in == 0);
+	if (zs->avail_in != 0) {
+		i_assert(zstream->ostream.ostream.last_failed_errno != 0);
+		zstream->ostream.ostream.stream_errno =
+			zstream->ostream.ostream.last_failed_errno;
+		return -1;
+	}
 
 	if (zstream->flushed)
 		return 0;


More information about the dovecot-cvs mailing list