1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:47:44 +00:00

LibWasm: Keep track of created directory fds in path_create_directory

This commit is contained in:
Ali Mohammad Pur 2023-05-04 00:38:54 +03:30 committed by Andreas Kling
parent 5121b368cd
commit 47248a3511
3 changed files with 9 additions and 0 deletions

View file

@ -636,12 +636,16 @@ ErrorOr<Result<FD>> Implementation::impl$path_open(Configuration& configuration,
auto path_data = TRY(slice_typed_memory(configuration, path, path_len));
auto path_string = DeprecatedString::copy(path_data);
dbgln_if(WASI_FINE_GRAINED_DEBUG, "path_open: dir_fd={}, path={}, open_flags={}", dir_fd, path_string, open_flags);
int opened_fd = openat(dir_fd, path_string.characters(), open_flags, 0644);
if (opened_fd < 0)
return errno_value_from_errno(errno);
// FIXME: Implement Rights and RightsInheriting.
m_fd_map.insert(opened_fd, static_cast<u32>(opened_fd));
return FD(opened_fd);
}