diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2010-04-20 01:12:08 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2010-04-20 01:12:08 +0400 |
commit | 7ccfcda370a2c385181580db9b8f82b3f53156b7 (patch) | |
tree | f8dd9e0ba5cbc078925d8a87bc14f96c0757580e /support | |
parent | e965fa47ceba45ef772c235f8be48c4596062d69 (diff) |
2010-04-19 Gonzalo Paniagua Javier <gonzalo@novell.com>
* zlib-helper.c: don't call Z_FINISH if nothing has been written.
svn path=/trunk/mono/; revision=155764
Diffstat (limited to 'support')
-rw-r--r-- | support/ChangeLog | 4 | ||||
-rw-r--r-- | support/zlib-helper.c | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index 29f02b0d38e..f659acd732b 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,7 @@ +2010-04-19 Gonzalo Paniagua Javier <gonzalo@novell.com> + + * zlib-helper.c: don't call Z_FINISH if nothing has been written. + 2010-04-19 Jonathan Pryor <jpryor@novell.com> * dirent.c, grp.c, macros.c, pwd.c, signal.c, sys-statvfs.c, sys-time.c, diff --git a/support/zlib-helper.c b/support/zlib-helper.c index 23c662bf74d..66b58663a5e 100644 --- a/support/zlib-helper.c +++ b/support/zlib-helper.c @@ -103,12 +103,14 @@ CloseZStream (ZStream *zstream) status = 0; if (zstream->compress) { - 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; + if (zstream->stream->total_in > 0) { + 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); |