artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eef95d0
)
Fix bug when gzungetc() is used immediately after gzopen().
author
tb
<tb@openbsd.org>
Sat, 12 Aug 2023 13:49:29 +0000
(13:49 +0000)
committer
tb
<tb@openbsd.org>
Sat, 12 Aug 2023 13:49:29 +0000
(13:49 +0000)
from upstream
lib/libz/gzread.c
patch
|
blob
|
history
diff --git
a/lib/libz/gzread.c
b/lib/libz/gzread.c
index
6034a28
..
4168cbc
100644
(file)
--- a/
lib/libz/gzread.c
+++ b/
lib/libz/gzread.c
@@
-443,6
+443,10
@@
int ZEXPORT gzungetc(int c, gzFile file) {
return -1;
state = (gz_statep)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))