Skip to content

Commit a010fbe

Browse files
committed
Possible fix for wasip1 file_open test
prtest:full
1 parent d08844c commit a010fbe

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/wasi-common/src/snapshots/preview_1.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,13 @@ impl wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
814814
drop(dir_entry);
815815

816816
let fd = match file {
817+
// Paper over a divergence between Windows and POSIX, where
818+
// POSIX returns EISDIR if you open a directory with the
819+
// WRITE flag: https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html#:~:text=EISDIR
820+
#[cfg(windows)]
821+
OpenResult::Dir(_) if write => {
822+
return Err(types::Errno::Isdir.into());
823+
}
817824
OpenResult::File(file) => table.push(Arc::new(FileEntry::new(file, access_mode)))?,
818825
OpenResult::Dir(child_dir) => table.push(Arc::new(DirEntry::new(None, child_dir)))?,
819826
};

0 commit comments

Comments
 (0)