X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fungetc.c;h=180673a47663ad57b11d3e6525c35cc23858939a;hb=11894f6d3a80be950a490dc7dfab349f057a545f;hp=7f56f8d5f07b79dba384f9ef02fe2b8c160b6467;hpb=e3cd6c5c265cd481db6e0c5b529855d99f0bda30;p=musl 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; }