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 | |
| parent | f32370e5420556c41ecf8c1e4620bed0e9f8f08a (diff) | |
| download | zlib-0a81dc026c4e727e9498654d703730ef8efbb8de.tar.gz zlib-0a81dc026c4e727e9498654d703730ef8efbb8de.tar.bz2 zlib-0a81dc026c4e727e9498654d703730ef8efbb8de.zip | |
Fix bug in gzgets() for a concatenated empty gzip stream.
| -rw-r--r-- | gzread.c | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -569,14 +569,14 @@ char * ZEXPORT gzgets(file, buf, len) | |||
| 569 | left = (unsigned)len - 1; | 569 | left = (unsigned)len - 1; |
| 570 | if (left) do { | 570 | if (left) do { |
| 571 | /* assure that something is in the output buffer */ | 571 | /* assure that something is in the output buffer */ |
| 572 | if (state->have == 0) { | 572 | while (state->have == 0 && (state->strm.avail_in || !state->eof)) { |
| 573 | if (gz_make(state) == -1) | 573 | if (gz_make(state) == -1) |
| 574 | return NULL; /* error */ | 574 | return NULL; /* error */ |
| 575 | if (state->have == 0) { /* end of file */ | 575 | } |
| 576 | if (buf == str) /* got bupkus */ | 576 | if (state->have == 0) { /* end of file */ |
| 577 | return NULL; | 577 | if (buf == str) /* got bupkus */ |
| 578 | break; /* got something -- return it */ | 578 | return NULL; |
| 579 | } | 579 | break; /* got something -- return it */ |
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | /* look for end-of-line in current output buffer */ | 582 | /* look for end-of-line in current output buffer */ |
