Skip to content

Commit

Permalink
Fix Sanitizer failures in FS tests (#23243)
Browse files Browse the repository at this point in the history
* Add a mode parameter to the open() call in test_fs_enotdir to avoid
  reading the uninitialized parameter when using O_CREAT
* Add a call to closedir pair the call to fdopendir in in
test_fs_readdir_ino_matches_stat_ino, which allows the implementation to
  free the underlying stream and make LSan happy.
  • Loading branch information
dschuff authored Dec 20, 2024
1 parent 3d4df5b commit 06f343d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/fs/test_fs_enotdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main() {
assert(errno == ENOTDIR);
}
{
assert(open("./does-not-exist/", O_CREAT) == -1);
assert(open("./does-not-exist/", O_CREAT, 0777) == -1);
assert(errno == EISDIR);
}
printf("success\n");
Expand Down
1 change: 1 addition & 0 deletions test/fs/test_fs_readdir_ino_matches_stat_ino.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ int main() {
assert(a_ino == sta.st_ino);
assert(b_ino == stb.st_ino);
printf("success\n");
closedir(dirp);
return 0;
}

0 comments on commit 06f343d

Please sign in to comment.