Skip to content

Commit

Permalink
Merge pull request #288 from igrr/bugfix/spiffs_readdir_errcode
Browse files Browse the repository at this point in the history
fix SPIFFS_readdir setting errno to SPIFFS_VIS_END at the end of iteration
  • Loading branch information
pellepl authored Jun 1, 2022
2 parents 2b73a7f + 1239341 commit 0dbb3f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/spiffs_hydrogen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,8 @@ struct spiffs_dirent *SPIFFS_readdir(spiffs_DIR *d, struct spiffs_dirent *e) {
d->entry = entry + 1;
e->obj_id &= ~SPIFFS_OBJ_ID_IX_FLAG;
ret = e;
} else if (res == SPIFFS_VIS_END) {
// end of iteration
} else {
d->fs->err_code = res;
}
Expand Down
1 change: 1 addition & 0 deletions src/test/test_hydrogen.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ TEST(list_dir)
#endif
}
}
TEST_CHECK_EQ(SPIFFS_errno(FS), SPIFFS_OK);
SPIFFS_closedir(&d);

TEST_CHECK(found == file_cnt);
Expand Down

0 comments on commit 0dbb3f7

Please sign in to comment.