Skip to content

Commit

Permalink
Auto merge of #74972 - second-state:wasi-right-fix, r=KodrAus
Browse files Browse the repository at this point in the history
Fix std::fs::File::metadata permission on WASI target

Previously `std::fs::File::metadata` on wasm32-wasi would call `fd_filestat_get`
to get metadata associated with fd, but that fd is opened without
RIGHTS_FD_FILESTAT_GET right, so it will failed on correctly implemented WASI
environment.

This change instead to add the missing rights when opening an fd.
  • Loading branch information
bors committed Aug 2, 2020
2 parents 12799ad + 4c85179 commit 1e99138
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/std/src/sys/wasi/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ impl OpenOptions {
// FIXME: some of these should probably be read-only or write-only...
base |= wasi::RIGHTS_FD_ADVISE;
base |= wasi::RIGHTS_FD_FDSTAT_SET_FLAGS;
base |= wasi::RIGHTS_FD_FILESTAT_GET;
base |= wasi::RIGHTS_FD_FILESTAT_SET_TIMES;
base |= wasi::RIGHTS_FD_SEEK;
base |= wasi::RIGHTS_FD_SYNC;
Expand Down

0 comments on commit 1e99138

Please sign in to comment.