mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 15:32:05 +00:00
Remove provision of unnecessary fd rights (#2579)
The WASI docs allow for fewer rights to be applied to an fd than requested but not more. This behavior is also asserted in the rust WASI tests, so it's necessary for those to pass as well.
This commit is contained in:
parent
0677288f22
commit
06527f724e
|
@ -1981,20 +1981,6 @@ wasmtime_ssp_path_open(wasm_exec_env_t exec_env, struct fd_table *curfds,
|
|||
return error;
|
||||
}
|
||||
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
if (fstat(nfd, &sb) < 0) {
|
||||
close(nfd);
|
||||
return convert_errno(errno);
|
||||
}
|
||||
|
||||
if (S_ISDIR(sb.st_mode))
|
||||
rights_base |= (__wasi_rights_t)RIGHTS_DIRECTORY_BASE;
|
||||
else if (S_ISREG(sb.st_mode))
|
||||
rights_base |= (__wasi_rights_t)RIGHTS_REGULAR_FILE_BASE;
|
||||
}
|
||||
|
||||
return fd_table_insert_fd(exec_env, curfds, nfd, type,
|
||||
rights_base & max_base,
|
||||
rights_inheriting & max_inheriting, fd);
|
||||
|
|
Loading…
Reference in New Issue
Block a user