TEST(fdopendir, empty) { DIR *dirp = fdopendir(fd_tmp); ASSERT_NE(NULL, dirp); // We should see exactly two directory entries. The order may differ. struct dirent *de = readdir(dirp); if (strcmp(".", de->d_name) == 0) { test_dot(fd_tmp, de); de = readdir(dirp); test_dotdot(de); } else { test_dotdot(de); de = readdir(dirp); test_dot(fd_tmp, de); } ASSERT_EQ(NULL, readdir(dirp)); ASSERT_EQ(fd_tmp, fdclosedir(dirp)); }
int closedir(DIR *dirp) { return (_close(fdclosedir(dirp))); }