[Zlib-devel] Allow gzread to continue after EOF

Mark Brown broonie at sirena.org.uk
Tue Jun 21 06:55:52 EDT 2005


This patch by Khalid Aziz <khalid_aziz at hp.com> allows gzio to continue
reading a file where it has seen EOF should it continue to grow (for
example, a log file being written using gzio).  This worked with zlib
1.2.1 but fails with more recent versions of zlib.

Could you please consider it for inclusion in the next version of zlib?

-- 
"You grabbed my hand and we fell into it, like a daydream - or a fever."

diff -urN zlib-1.2.2.orig/gzio.c zlib-1.2.2/gzio.c
--- zlib-1.2.2.orig/gzio.c	2004-10-03 22:30:37.000000000 -0400
+++ zlib-1.2.2/gzio.c	2005-03-01 16:43:05.000000000 -0500
@@ -403,7 +403,9 @@
     if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
 
     if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
-    if (s->z_err == Z_STREAM_END) return 0;  /* EOF */
+    if (s->z_eof == 1) {
+      return 0;  /* EOF */
+    }
 
     next_out = (Byte*)buf;
     s->stream.next_out = (Bytef*)buf;





More information about the Zlib-devel mailing list