summaryrefslogtreecommitdiff
path: root/src/stdio
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-28 17:31:01 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-28 17:31:01 -0400
commit05b694028e0537954ea2d5e69774e0c24bf9ab47 (patch)
tree50933074aea2e442ea27677be498e8b071914d2a /src/stdio
parente3cd6c5c265cd481db6e0c5b529855d99f0bda30 (diff)
downloadmusl-05b694028e0537954ea2d5e69774e0c24bf9ab47.tar.gz
fix getc - the classic error of trying to store EOF+0-255 in a char type..
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/__uflow.c6
1 files changed, 3 insertions, 3 deletions
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;
}