From 2c5ef81e825eb7f787cbfb658adac747f55fac41 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 28 Apr 2024 15:21:58 +0200 Subject: [PATCH] Hotfix for readdir bug in latest newlib version --- src/FSWrapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FSWrapper.cpp b/src/FSWrapper.cpp index 2982deb..c271e9a 100644 --- a/src/FSWrapper.cpp +++ b/src/FSWrapper.cpp @@ -125,8 +125,8 @@ FSError FSWrapper::FSReadDirWrapper(FSDirectoryHandle handle, FSDirectoryEntry * result = FS_ERROR_OK; } else { auto err = errno; - if (err != 0) { - DEBUG_FUNCTION_LINE_ERR("[%s] Failed to read dir %08X (handle %08X)", getName().c_str(), dir, handle); + if (err != 0 && err != 2) { // newlib currently has a bug and doesn't clear errno properly when the end of a dir is reached + DEBUG_FUNCTION_LINE_ERR("[%s] Failed to read dir %08X (handle %08X). errno %d (%s)", getName().c_str(), dir, handle, err, strerror(err)); result = FS_ERROR_MEDIA_ERROR; } }