mirror of git://git.musl-libc.org/musl
fix getc - the classic error of trying to store EOF+0-255 in a char type..
This commit is contained in:
parent
e3cd6c5c26
commit
05b694028e
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
int __uflow(FILE *f)
|
int __uflow(FILE *f)
|
||||||
{
|
{
|
||||||
unsigned char c = EOF;
|
unsigned char c;
|
||||||
if (f->rend || !__toread(f)) f->read(f, &c, 1);
|
if ((f->rend || !__toread(f)) && f->read(f, &c, 1)==1) return c;
|
||||||
return c;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue