diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-24 00:29:46 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-24 00:29:46 -0700 |
commit | 0a81dc026c4e727e9498654d703730ef8efbb8de (patch) | |
tree | c7e30be6776405e75755b9487853ae4a466094dc /gzread.c | |
parent | f32370e5420556c41ecf8c1e4620bed0e9f8f08a (diff) | |
download | zlib-0a81dc026c4e727e9498654d703730ef8efbb8de.tar.gz |
Fix bug in gzgets() for a concatenated empty gzip stream.
Diffstat (limited to 'gzread.c')
-rw-r--r-- | gzread.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -569,14 +569,14 @@ char * ZEXPORT gzgets(file, buf, len) left = (unsigned)len - 1; if (left) do { /* assure that something is in the output buffer */ - if (state->have == 0) { + while (state->have == 0 && (state->strm.avail_in || !state->eof)) { if (gz_make(state) == -1) return NULL; /* error */ - if (state->have == 0) { /* end of file */ - if (buf == str) /* got bupkus */ - return NULL; - break; /* got something -- return it */ - } + } + if (state->have == 0) { /* end of file */ + if (buf == str) /* got bupkus */ + return NULL; + break; /* got something -- return it */ } /* look for end-of-line in current output buffer */ |