Skip to content

Commit d0dfbd6

Browse files
committed
Hotfix for readdir bug in latest newlib version
1 parent a2c8863 commit d0dfbd6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/FSWrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ FSError FSWrapper::FSReadDirWrapper(FSDirectoryHandle handle, FSDirectoryEntry *
125125
result = FS_ERROR_OK;
126126
} else {
127127
auto err = errno;
128-
if (err != 0) {
129-
DEBUG_FUNCTION_LINE_ERR("[%s] Failed to read dir %08X (handle %08X)", getName().c_str(), dir, handle);
128+
if (err != 0 && err != 2) { // newlib currently has a bug and doesn't clear errno properly when the end of a dir is reached
129+
DEBUG_FUNCTION_LINE_ERR("[%s] Failed to read dir %08X (handle %08X). errno %d (%s)", getName().c_str(), dir, handle, err, strerror(err));
130130
result = FS_ERROR_MEDIA_ERROR;
131131
}
132132
}

0 commit comments

Comments
 (0)