Without this patch this test progrma:

#include <zlib.h>

int main(void) {
	gzFile fd;
	char buffer[256];
	fd = gzdopen(dup(0), "rb");
	while(gzread(fd, buffer, 256));
	gzclose(fd);
	return 0;
}

takes multiple control Ds to notice the end of file.  Reported against
libxml2 by Thomas Leonard <tal00r@ecs.soton.ac.uk>, forwarded with test
program by Mike Hommey <mh@glandium.org>.

--- zlib-1.2.3.orig/gzio.c	2005-10-30 10:56:39.000000000 +0000
+++ zlib-1.2.3/gzio.c	2005-10-30 10:55:36.000000000 +0000
@@ -301,6 +301,7 @@
         if (len) s->inbuf[0] = s->stream.next_in[0];
         errno = 0;
         len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
+	if (len == 0) s->z_eof = 1;
         if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO;
         s->stream.avail_in += len;
         s->stream.next_in = s->inbuf;
@@ -436,7 +437,7 @@
                 s->stream.avail_out -= n;
                 s->stream.avail_in  -= n;
             }
-            if (s->stream.avail_out > 0) {
+            if (s->stream.avail_out > 0 && !feof(s->file)) {
                 s->stream.avail_out -=
                     (uInt)fread(next_out, 1, s->stream.avail_out, s->file);
             }
