diff --git a/crates/test-programs/wasi-tests/src/bin/file_pread_pwrite.rs b/crates/test-programs/wasi-tests/src/bin/file_pread_pwrite.rs index e7773fea72..b9e9924ed1 100644 --- a/crates/test-programs/wasi-tests/src/bin/file_pread_pwrite.rs +++ b/crates/test-programs/wasi-tests/src/bin/file_pread_pwrite.rs @@ -14,7 +14,7 @@ unsafe fn test_file_pread_pwrite(dir_fd: wasi_unstable::Fd) { 0, "file", wasi_unstable::O_CREAT, - wasi_unstable::RIGHT_FD_READ | wasi_unstable::RIGHT_FD_WRITE, + wasi_unstable::RIGHT_FD_READ | wasi_unstable::RIGHT_FD_SEEK | wasi_unstable::RIGHT_FD_WRITE, 0, 0, &mut file_fd, diff --git a/crates/wasi-common/src/hostcalls_impl/fs.rs b/crates/wasi-common/src/hostcalls_impl/fs.rs index ae2485be21..382e00c99d 100644 --- a/crates/wasi-common/src/hostcalls_impl/fs.rs +++ b/crates/wasi-common/src/hostcalls_impl/fs.rs @@ -61,7 +61,7 @@ pub(crate) unsafe fn fd_pread( let fd = wasi_ctx .get_fd_entry(fd)? - .as_descriptor(wasi::__WASI_RIGHT_FD_READ, 0)? + .as_descriptor(wasi::__WASI_RIGHT_FD_READ | wasi::__WASI_RIGHT_FD_SEEK, 0)? .as_file()?; let iovs = dec_iovec_slice(memory, iovs_ptr, iovs_len)?; @@ -110,7 +110,7 @@ pub(crate) unsafe fn fd_pwrite( let fd = wasi_ctx .get_fd_entry(fd)? - .as_descriptor(wasi::__WASI_RIGHT_FD_WRITE, 0)? + .as_descriptor(wasi::__WASI_RIGHT_FD_WRITE | wasi::__WASI_RIGHT_FD_SEEK, 0)? .as_file()?; let iovs = dec_ciovec_slice(memory, iovs_ptr, iovs_len)?;