dovecot-2.2: istream-zlib: Don't overwrite parent istream's erro...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 30 11:29:21 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/7a6452869981
changeset: 18898:7a6452869981
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 30 14:26:00 2015 +0300
description:
istream-zlib: Don't overwrite parent istream's error on gz header/trailer read errors.

diffstat:

 src/lib-compression/istream-zlib.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r 3bf5df6f63b2 -r 7a6452869981 src/lib-compression/istream-zlib.c
--- a/src/lib-compression/istream-zlib.c	Tue Jun 30 13:58:15 2015 +0300
+++ b/src/lib-compression/istream-zlib.c	Tue Jun 30 14:26:00 2015 +0300
@@ -75,7 +75,8 @@
 	ret = i_stream_read_data(stream->parent, &data, &size,
 				 zstream->prev_size);
 	if (size == zstream->prev_size) {
-		if (ret == -1) {
+		stream->istream.stream_errno = stream->parent->stream_errno;
+		if (ret == -1 && stream->istream.stream_errno == 0) {
 			zlib_read_error(zstream, "missing gz header");
 			stream->istream.stream_errno = EINVAL;
 		}
@@ -141,7 +142,8 @@
 	ret = i_stream_read_data(stream->parent, &data, &size,
 				 GZ_TRAILER_SIZE-1);
 	if (size == zstream->prev_size) {
-		if (ret == -1) {
+		stream->istream.stream_errno = stream->parent->stream_errno;
+		if (ret == -1 && stream->istream.stream_errno == 0) {
 			zlib_read_error(zstream, "missing gz trailer");
 			stream->istream.stream_errno = EINVAL;
 		}


More information about the dovecot-cvs mailing list