diff --git a/mlibc/libc-mes.c b/mlibc/libc-mes.c index 3375a958..3fbd68be 100644 --- a/mlibc/libc-mes.c +++ b/mlibc/libc-mes.c @@ -191,8 +191,11 @@ int fgetc (int fd) { char c; + int i; int r = read (fd, &c, 1); - return c == 1 ? c : (-1); + if (r < 1) return -1; + i = c; + return i; } void