Fix bug in gzgets() for a concatenated empty gzip stream.

This commit is contained in:
Mark Adler 2011-09-24 00:29:46 -07:00
parent f32370e542
commit 0a81dc026c
1 changed files with 6 additions and 6 deletions

View File

@ -569,14 +569,14 @@ char * ZEXPORT gzgets(file, buf, len)
left = (unsigned)len - 1; left = (unsigned)len - 1;
if (left) do { if (left) do {
/* assure that something is in the output buffer */ /* 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) if (gz_make(state) == -1)
return NULL; /* error */ return NULL; /* error */
if (state->have == 0) { /* end of file */ }
if (buf == str) /* got bupkus */ if (state->have == 0) { /* end of file */
return NULL; if (buf == str) /* got bupkus */
break; /* got something -- return it */ return NULL;
} break; /* got something -- return it */
} }
/* look for end-of-line in current output buffer */ /* look for end-of-line in current output buffer */