about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-06-06 18:20:30 +0000
committerRich Felker <dalias@aerifal.cx>2015-06-06 18:20:30 +0000
commit312eea2ea4f4363fb01b73660c08bfcf43dd3bb4 (patch)
treeebda0303545cf51976e4994b54b7ca180a03af2d /src
parent3d7e32d28dc9962e9efc1c317c5b44b5b2df3008 (diff)
downloadmusl-312eea2ea4f4363fb01b73660c08bfcf43dd3bb4.tar.gz
musl-312eea2ea4f4363fb01b73660c08bfcf43dd3bb4.tar.xz
musl-312eea2ea4f4363fb01b73660c08bfcf43dd3bb4.zip
remove another invalid skip of locking in ungetwc
Diffstat (limited to 'src')
-rw-r--r--src/stdio/ungetwc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/stdio/ungetwc.c b/src/stdio/ungetwc.c
index 0a4cd7a1..394f92ac 100644
--- a/src/stdio/ungetwc.c
+++ b/src/stdio/ungetwc.c
@@ -9,14 +9,12 @@ wint_t ungetwc(wint_t c, FILE *f)
 	unsigned char mbc[MB_LEN_MAX];
 	int l=1;
 
-	if (c == WEOF) return c;
-
 	FLOCK(f);
 
 	f->mode |= f->mode+1;
 
 	if (!f->rpos) __toread(f);
-	if (!f->rpos || f->rpos < f->buf - UNGET + l ||
+	if (!f->rpos || f->rpos < f->buf - UNGET + l || c == WEOF ||
 	    (!isascii(c) && (l = wctomb((void *)mbc, c)) < 0)) {
 		FUNLOCK(f);
 		return WEOF;