Skip to content

Commit 8f43223

Browse files
author
Cruz Monrreal
authored
Merge pull request #7412 from bmcdonnell-ionx/bugfix-fatfs-dir-list-when-full
apply FatFs 0.13b hotfix - fix readdir() never terminates when dir is full
2 parents 69d8c0b + efc0329 commit 8f43223

File tree

1 file changed

+2
-1
lines changed
  • features/filesystem/fat/ChaN

1 file changed

+2
-1
lines changed

features/filesystem/fat/ChaN/ff.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,8 @@ FRESULT dir_next ( /* FR_OK(0):succeeded, FR_NO_FILE:End of table, FR_DENIED:Cou
17401740

17411741

17421742
ofs = dp->dptr + SZDIRE; /* Next entry */
1743-
if (dp->sect == 0 || ofs >= (DWORD)((FF_FS_EXFAT && fs->fs_type == FS_EXFAT) ? MAX_DIR_EX : MAX_DIR)) return FR_NO_FILE; /* Report EOT when offset has reached max value */
1743+
if (ofs >= (DWORD)((FF_FS_EXFAT && fs->fs_type == FS_EXFAT) ? MAX_DIR_EX : MAX_DIR)) dp->sect = 0; /* Disable it if the offset reached the max value */
1744+
if (dp->sect == 0) return FR_NO_FILE; /* Report EOT if it has been disabled */
17441745

17451746
if (ofs % SS(fs) == 0) { /* Sector changed? */
17461747
dp->sect++; /* Next sector */

0 commit comments

Comments
 (0)