diff options
Diffstat (limited to 'gzio.c')
-rw-r--r-- | gzio.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -889,7 +889,13 @@ int ZEXPORT gzeof (file) | |||
889 | { | 889 | { |
890 | gz_stream *s = (gz_stream*)file; | 890 | gz_stream *s = (gz_stream*)file; |
891 | 891 | ||
892 | return (s == NULL || s->mode != 'r') ? 0 : s->z_eof; | 892 | /* With concatenated compressed files that can have embedded |
893 | * crc trailers, z_eof is no longer the only/best indicator of EOF | ||
894 | * on a gz_stream. Handle end-of-stream error explicitly here. | ||
895 | */ | ||
896 | if (s == NULL || s->mode != 'r') return 0; | ||
897 | if (s->z_eof) return 1; | ||
898 | return s->z_err == Z_STREAM_END; | ||
893 | } | 899 | } |
894 | 900 | ||
895 | /* =========================================================================== | 901 | /* =========================================================================== |