~aleteoryx/muditaos

46aa1ee4e7899f535e48616fd2f303dfc1f2ee0f — Lucjan Bryndza 5 years ago 1981c8b
[EGD-4505] Fix problem with fread (#1092)

FIX: Fread from stdio returns not enough of data

Co-authored-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
1 files changed, 2 insertions(+), 1 deletions(-)

M module-vfs/src/newlib/vfs_io_syscalls.cpp
M module-vfs/src/newlib/vfs_io_syscalls.cpp => module-vfs/src/newlib/vfs_io_syscalls.cpp +2 -1
@@ 33,6 33,7 @@ namespace vfsn::internal
    {
        auto open_to_fopen_flags(int flags)
        {
            flags &= ~0x00010000; // Ignore binary
            if ((flags & O_RDONLY) || !flags) {
                return "r";
            }


@@ 126,7 127,7 @@ namespace vfsn::internal::syscalls
            _errno_ = EBADF;
            return -1;
        }
        auto ret = ff_fread(buf, cnt, 1, fil);
        auto ret = ff_fread(buf, 1, cnt, fil);
        _errno_  = stdioGET_ERRNO();
        return ret * cnt;
    }