summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gzread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gzread.c b/gzread.c
index 6034a28..4168cbc 100644
--- a/gzread.c
+++ b/gzread.c
@@ -443,6 +443,10 @@ int ZEXPORT gzungetc(int c, gzFile file) {
443 return -1; 443 return -1;
444 state = (gz_statep)file; 444 state = (gz_statep)file;
445 445
446 /* in case this was just opened, set up the input buffer */
447 if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
448 (void)gz_look(state);
449
446 /* check that we're reading and that there's no (serious) error */ 450 /* check that we're reading and that there's no (serious) error */
447 if (state->mode != GZ_READ || 451 if (state->mode != GZ_READ ||
448 (state->err != Z_OK && state->err != Z_BUF_ERROR)) 452 (state->err != Z_OK && state->err != Z_BUF_ERROR))