mirror of
https://github.com/shadps4-emu/ext-zlib-ng.git
synced 2026-01-31 00:55:17 +01:00
Fix bug when gzungetc() is used immediately after gzopen().
This commit is contained in:
committed by
Hans Kristian Rosbach
parent
faf6cf70cd
commit
135cdad8ca
@@ -445,6 +445,10 @@ int Z_EXPORT PREFIX(gzungetc)(int c, gzFile file) {
|
||||
return -1;
|
||||
state = (gz_state *)file;
|
||||
|
||||
/* in case this was just opened, set up the input buffer */
|
||||
if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
|
||||
(void)gz_look(state);
|
||||
|
||||
/* check that we're reading and that there's no (serious) error */
|
||||
if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR))
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user