Skip to content

Commit

Permalink
wasi-common: fix fdstat of dirfd
Browse files Browse the repository at this point in the history
the fdstat of a dirfd needs to include both the file and dir rights in
the inheriting field.

The wasi-libc path_open bases the base rights of child directories off
the inheriting rights of the parent, so if we only put file rights in
there, opening a child directory will not have any directory operations
permitted.

Fixes #2638
  • Loading branch information
pchickey committed Feb 9, 2021
1 parent 1fe58fe commit f357daa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/wasi-common/src/snapshots/preview_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ impl From<&FdStat> for types::Fdstat {
impl From<&DirFdStat> for types::Fdstat {
fn from(dirstat: &DirFdStat) -> types::Fdstat {
let fs_rights_base = types::Rights::from(&dirstat.dir_caps);
let fs_rights_inheriting = types::Rights::from(&dirstat.file_caps);
let fs_rights_inheriting = types::Rights::from(&dirstat.file_caps) | fs_rights_base;
types::Fdstat {
fs_filetype: types::Filetype::Directory,
fs_rights_base,
Expand Down

0 comments on commit f357daa

Please sign in to comment.