Skip to content

Commit 2e830ac

Browse files
committed
filesystem: ErrorCode::IsDirectory when opening director w/o READ
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 2e830ac

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/wasi/src/filesystem.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,10 @@ 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+
10481052
OpenResult::Dir(dir) => Ok(Descriptor::Dir(Dir::new(
10491053
dir,
10501054
self.perms,

0 commit comments

Comments
 (0)