dovecot-2.0: zlib: Fixed zlib/bzlib ostream flushing to report c...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 29 20:14:48 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/c8f4cb187343
changeset: 11226:c8f4cb187343
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 29 20:14:43 2010 +0300
description:
zlib: Fixed zlib/bzlib ostream flushing to report correctly when it's finished.
This caused imap-zlib plugin to eat all CPU when stream compression was used.
Patch by Apple.

diffstat:

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

diffs (46 lines):

diff -r ec84aad32983 -r c8f4cb187343 src/plugins/zlib/ostream-bzlib.c
--- a/src/plugins/zlib/ostream-bzlib.c	Thu Apr 29 20:11:19 2010 +0300
+++ b/src/plugins/zlib/ostream-bzlib.c	Thu Apr 29 20:14:43 2010 +0300
@@ -122,15 +122,15 @@
 static int o_stream_bzlib_flush(struct ostream_private *stream)
 {
 	struct bzlib_ostream *zstream = (struct bzlib_ostream *)stream;
+	int ret;
 
 	if (o_stream_bzlib_send_flush(zstream) < 0)
 		return -1;
 
-	if (o_stream_flush(zstream->output) < 0) {
+	ret = o_stream_flush(zstream->output);
+	if (ret < 0)
 		zstream_copy_error(zstream);
-		return -1;
-	}
-	return 0;
+	return ret;
 }
 
 static ssize_t
diff -r ec84aad32983 -r c8f4cb187343 src/plugins/zlib/ostream-zlib.c
--- a/src/plugins/zlib/ostream-zlib.c	Thu Apr 29 20:11:19 2010 +0300
+++ b/src/plugins/zlib/ostream-zlib.c	Thu Apr 29 20:14:43 2010 +0300
@@ -184,15 +184,15 @@
 static int o_stream_zlib_flush(struct ostream_private *stream)
 {
 	struct zlib_ostream *zstream = (struct zlib_ostream *)stream;
+	int ret;
 
 	if (o_stream_zlib_send_flush(zstream) < 0)
 		return -1;
 
-	if (o_stream_flush(zstream->output) < 0) {
+	ret = o_stream_flush(zstream->output);
+	if (ret < 0)
 		zstream_copy_error(zstream);
-		return -1;
-	}
-	return 0;
+	return ret;
 }
 
 static ssize_t


More information about the dovecot-cvs mailing list