From: Mark Adler Date: Fri, 13 Oct 2017 04:07:22 +0000 (-0700) Subject: Fix deflateEnd() to not report an error at start of raw deflate. X-Git-Tag: 1.9.9-b1~656^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F130%2Fhead;p=thirdparty%2Fzlib-ng.git Fix deflateEnd() to not report an error at start of raw deflate. --- diff --git a/deflate.c b/deflate.c index 071ce679..c4bedfb8 100644 --- a/deflate.c +++ b/deflate.c @@ -462,7 +462,7 @@ int ZEXPORT deflateResetKeep(z_stream *strm) { #ifdef GZIP s->wrap == 2 ? GZIP_STATE : #endif - s->wrap ? INIT_STATE : BUSY_STATE; + INIT_STATE; #ifdef GZIP if (s->wrap == 2) @@ -756,6 +756,8 @@ int ZEXPORT deflate(z_stream *strm, int flush) { } /* Write the header */ + if (s->status == INIT_STATE && s->wrap == 0) + s->status = BUSY_STATE; if (s->status == INIT_STATE) { /* zlib header */ unsigned int header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;