浏览代码

remove another invalid skip of locking in ungetwc

Rich Felker 10 年之前
父节点
当前提交
312eea2ea4
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      src/stdio/ungetwc.c

+ 1 - 3
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;