mlibc: Mescc-tools support: fix fgetc.

* mlibc/libc-mes.c (fgetc): Fix from completely fubar.
This commit is contained in:
Jan Nieuwenhuizen 2017-11-19 16:54:59 +01:00
parent 8eae2d81a4
commit e4bb2e1762

View file

@ -191,8 +191,11 @@ int
fgetc (int fd) fgetc (int fd)
{ {
char c; char c;
int i;
int r = read (fd, &c, 1); int r = read (fd, &c, 1);
return c == 1 ? c : (-1); if (r < 1) return -1;
i = c;
return i;
} }
void void