Skip to content

Commit b6aaf35

Browse files
authored
filesystem: ErrorCode::IsDirectory when opening director w/o READ (#12136)
On Windows, it was possible to return a directory descriptor if READ wasn't in the permissions. Fixes wasmtime for WebAssembly/wasi-testsuite#176.
1 parent 69ef9af commit b6aaf35

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/wasi/src/filesystem.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,11 @@ impl Dir {
10451045
.await?;
10461046

10471047
match opened {
1048+
#[cfg(windows)]
1049+
OpenResult::Dir(dir) if !flags.contains(DescriptorFlags::READ) => {
1050+
Err(ErrorCode::IsDirectory)
1051+
}
1052+
10481053
OpenResult::Dir(dir) => Ok(Descriptor::Dir(Dir::new(
10491054
dir,
10501055
self.perms,

0 commit comments

Comments
 (0)