Skip to content

Commit 06f343d

Browse files
authored
Fix Sanitizer failures in FS tests (#23243)
* 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.
1 parent 3d4df5b commit 06f343d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

test/fs/test_fs_enotdir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int main() {
1717
assert(errno == ENOTDIR);
1818
}
1919
{
20-
assert(open("./does-not-exist/", O_CREAT) == -1);
20+
assert(open("./does-not-exist/", O_CREAT, 0777) == -1);
2121
assert(errno == EISDIR);
2222
}
2323
printf("success\n");

test/fs/test_fs_readdir_ino_matches_stat_ino.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ int main() {
5858
assert(a_ino == sta.st_ino);
5959
assert(b_ino == stb.st_ino);
6060
printf("success\n");
61+
closedir(dirp);
6162
return 0;
6263
}

0 commit comments

Comments
 (0)