about summary refs log tree commit diff
path: root/src/stdio/ungetwc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/ungetwc.c')
-rw-r--r--src/stdio/ungetwc.c3
1 files changed, 2 insertions, 1 deletions
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;
 	}