Make some touchups

This commit is contained in:
Justine Tunney 2022-07-15 18:07:34 -07:00
parent 6c49e36537
commit 2e3958c6dc
11 changed files with 161 additions and 63 deletions

View file

@ -117,6 +117,15 @@ TEST(open, testOpenExistingForAppendWriteOnly_seeksToEnd) {
EXPECT_SYS(0, 0, close(3));
}
TEST(open, testRelativePath_opensRelativeToDirFd) {
ASSERT_SYS(0, 0, mkdir("foo", 0755));
ASSERT_SYS(0, 3, open("foo", O_RDONLY | O_DIRECTORY));
EXPECT_SYS(0, 4, openat(3, "bar", O_WRONLY | O_TRUNC | O_CREAT, 0755));
EXPECT_TRUE(fileexists("foo/bar"));
EXPECT_SYS(0, 0, close(4));
EXPECT_SYS(0, 0, close(3));
}
int CountFds(void) {
int i, count;
for (count = i = 0; i < g_fds.n; ++i) {