Skip to content

Commit 1e99138

Browse files
committed
Auto merge of #74972 - second-state:wasi-right-fix, r=KodrAus
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.
2 parents 12799ad + 4c85179 commit 1e99138

File tree

1 file changed

+1
-0
lines changed
  • library/std/src/sys/wasi

1 file changed

+1
-0
lines changed

library/std/src/sys/wasi/fs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ impl OpenOptions {
331331
// FIXME: some of these should probably be read-only or write-only...
332332
base |= wasi::RIGHTS_FD_ADVISE;
333333
base |= wasi::RIGHTS_FD_FDSTAT_SET_FLAGS;
334+
base |= wasi::RIGHTS_FD_FILESTAT_GET;
334335
base |= wasi::RIGHTS_FD_FILESTAT_SET_TIMES;
335336
base |= wasi::RIGHTS_FD_SEEK;
336337
base |= wasi::RIGHTS_FD_SYNC;

0 commit comments

Comments
 (0)