Skip to content

Commit 2492043

Browse files
Skip . and .. on LittleFS::dir::rewind() (#6959)
Fixes #6958 To match SPIFFS, we get rid of the "." and ".." dirents when we open a directory on LittleFS. Do the same on a rewind().
1 parent 5d5200a commit 2492043

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libraries/LittleFS/src/LittleFS.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,10 @@ class LittleFSDirImpl : public DirImpl
567567
bool rewind() override {
568568
_valid = false;
569569
int rc = lfs_dir_rewind(_fs->getFS(), _getDir());
570+
// Skip the . and .. entries
571+
lfs_info dirent;
572+
lfs_dir_read(_fs->getFS(), _getDir(), &dirent);
573+
lfs_dir_read(_fs->getFS(), _getDir(), &dirent);
570574
return (rc == 0);
571575
}
572576

0 commit comments

Comments
 (0)