diff --git a/support/ChangeLog b/support/ChangeLog index 32b21db4240f3..fa8d473e48db8 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,8 @@ +2010-04-07 Gonzalo Paniagua Javier + + * zlib-helper.c: now that we don't use Z_SYNC_FLUSH, there might be + unflushed input in zstream, so always call Z_FINISH. + 2010-01-28 Gonzalo Paniagua Javier * zlib-helper.c: no need for sync flush when compressing. diff --git a/support/zlib-helper.c b/support/zlib-helper.c index f8f1587ccd9be..23c662bf74d6f 100644 --- a/support/zlib-helper.c +++ b/support/zlib-helper.c @@ -103,14 +103,12 @@ CloseZStream (ZStream *zstream) status = 0; if (zstream->compress) { - if (zstream->stream->total_out) { - do { - status = deflate (zstream->stream, Z_FINISH); - flush_status = Flush (zstream); - } while (status == Z_OK); /* We want Z_STREAM_END or error here here */ - if (status == Z_STREAM_END) - status = flush_status; - } + do { + status = deflate (zstream->stream, Z_FINISH); + flush_status = Flush (zstream); + } while (status == Z_OK); /* We want Z_STREAM_END or error here here */ + if (status == Z_STREAM_END) + status = flush_status; deflateEnd (zstream->stream); } else { inflateEnd (zstream->stream);