aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-26 18:20:32 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-26 18:20:32 -0700
commit50e440f081a0edc293dcfe7333a91d764e3d15cd (patch)
treefba356e28c0424ea53a1465844c471f4cd42476c
parent5ad116abdad08c49b9ab20d748550eecd2c1d96d (diff)
downloadzlib-50e440f081a0edc293dcfe7333a91d764e3d15cd.tar.gz
zlib-50e440f081a0edc293dcfe7333a91d764e3d15cd.tar.bz2
zlib-50e440f081a0edc293dcfe7333a91d764e3d15cd.zip
Allow gzrewind() and gzseek() after a premature end-of-file.
-rw-r--r--gzlib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gzlib.c b/gzlib.c
index e8cb479..c59bcda 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -265,7 +265,8 @@ int ZEXPORT gzrewind(file)
265 state = (gz_statep)file; 265 state = (gz_statep)file;
266 266
267 /* check that we're reading and that there's no error */ 267 /* check that we're reading and that there's no error */
268 if (state->mode != GZ_READ || state->err != Z_OK) 268 if (state->mode != GZ_READ ||
269 (state->err != Z_OK && state->err != Z_BUF_ERROR))
269 return -1; 270 return -1;
270 271
271 /* back up and start over */ 272 /* back up and start over */
@@ -293,7 +294,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
293 return -1; 294 return -1;
294 295
295 /* check that there's no error */ 296 /* check that there's no error */
296 if (state->err != Z_OK) 297 if (state->err != Z_OK && state->err != Z_BUF_ERROR)
297 return -1; 298 return -1;
298 299
299 /* can only seek from start or relative to current position */ 300 /* can only seek from start or relative to current position */