diff options
Diffstat (limited to 'src/stdio/ungetc.c')
-rw-r--r-- | src/stdio/ungetc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stdio/ungetc.c b/src/stdio/ungetc.c index 7f56f8d5..180673a4 100644 --- a/src/stdio/ungetc.c +++ b/src/stdio/ungetc.c @@ -6,7 +6,8 @@ int ungetc(int c, FILE *f) FLOCK(f); - if ((!f->rend && __toread(f)) || f->rpos <= f->buf - UNGET) { + if (!f->rpos) __toread(f); + if (!f->rpos || f->rpos <= f->buf - UNGET) { FUNLOCK(f); return EOF; } |