subsys/fs: correct misinterpretation of Zephyr API

The Zephyr fs readdir abstraction returns OK with a zero-length file
name when the last directory entry has been found.  The loop to build
multiple entries instead checked for a non-file entry type.

Correct the loop exit condition.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2019-10-08 14:18:07 -05:00 committed by Anas Nashif
parent 9b993bef6b
commit 452d3dea7a
1 changed files with 3 additions and 0 deletions

View File

@ -261,6 +261,9 @@ int fs_readdir(struct fs_dir_t *zdp, struct fs_dirent *entry)
if (rc < 0) {
break;
}
if (entry->name[0] == 0) {
break;
}
if (entry->type != FS_DIR_ENTRY_DIR) {
break;
}