projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e3cd6c5
)
fix getc - the classic error of trying to store EOF+0-255 in a char type..
author
Rich Felker
<dalias@aerifal.cx>
Mon, 28 Mar 2011 21:31:01 +0000
(17:31 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Mon, 28 Mar 2011 21:31:01 +0000
(17:31 -0400)
src/stdio/__uflow.c
patch
|
blob
|
history
diff --git
a/src/stdio/__uflow.c
b/src/stdio/__uflow.c
index 544dda982dbf0abf4ae703825d91e84ffd2bd94a..e28922c2ff461a960c37501d6cbe298fe8ca68f4 100644
(file)
--- 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
;
}