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/ungetwc.c | |
parent | b6e7c664677ab7c77f183b8c41105f2be519800c (diff) | |
download | musl-2b4fcfdacf93c3dfd6ac15e31790a9e154374679.tar.gz |
-rw-r--r-- | src/stdio/ungetwc.c | 3 |
diff --git a/src/stdio/ungetwc.c b/src/stdio/ungetwc.c index 8cc85a6b..913f7168 100644 --- a/src/stdio/ungetwc.c +++ b/src/stdio/ungetwc.c @@ -19,7 +19,8 @@ wint_t ungetwc(wint_t c, FILE *f) f->mode |= f->mode+1; - if ((!f->rend && __toread(f)) || f->rpos < f->buf - UNGET + l) { + if (!f->rpos) __toread(f); + if (!f->rpos || f->rpos < f->buf - UNGET + l) { FUNLOCK(f); return EOF; } |