From: Rich Felker Date: Mon, 28 Mar 2011 21:31:01 +0000 (-0400) Subject: fix getc - the classic error of trying to store EOF+0-255 in a char type.. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=05b694028e0537954ea2d5e69774e0c24bf9ab47;p=musl fix getc - the classic error of trying to store EOF+0-255 in a char type.. --- diff --git a/src/stdio/__uflow.c b/src/stdio/__uflow.c index 544dda98..e28922c2 100644 --- a/src/stdio/__uflow.c +++ b/src/stdio/__uflow.c @@ -5,7 +5,7 @@ int __uflow(FILE *f) { - unsigned char c = EOF; - if (f->rend || !__toread(f)) f->read(f, &c, 1); - return c; + unsigned char c; + if ((f->rend || !__toread(f)) && f->read(f, &c, 1)==1) return c; + return EOF; }