author | Rich Felker <dalias@aerifal.cx> | 2015年05月28日 23:08:12 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015年05月29日 00:04:36 -0400 |
commit | 2b4fcfdacf93c3dfd6ac15e31790a9e154374679 (patch) | |
tree | b4f112b30707d9772dfa8b61e9cfec870c690b46 /src/stdio/ungetc.c | |
parent | b6e7c664677ab7c77f183b8c41105f2be519800c (diff) | |
download | musl-2b4fcfdacf93c3dfd6ac15e31790a9e154374679.tar.gz |
-rw-r--r-- | src/stdio/ungetc.c | 3 |
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; } |