~aleteoryx/muditaos

0cea74888868b24f01bba4b916e754b04041ca98 — Wiktor S. Ovalle Correa 5 years ago dc2059f
[EGD-5596] Fix fread() handling of EOF

iosyscalls' fread() should interpret zero bytes read as EOF.
1 files changed, 1 insertions(+), 1 deletions(-)

M board/linux/libiosyscalls/src/syscalls_stdio.cpp
M board/linux/libiosyscalls/src/syscalls_stdio.cpp => board/linux/libiosyscalls/src/syscalls_stdio.cpp +1 -1
@@ 454,7 454,7 @@ extern "C"
                char *p = reinterpret_cast<char *>(__ptr);
                do {
                    auto res       = vfs::invoke_fs(&fs::read, fx->fd, p, __size);
                    const auto eof = res > 0 && size_t(res) < __size;
                    const auto eof = res >= 0 && size_t(res) < __size;
                    fx->error      = errno;
                    if (res < 0 || eof)
                        break;