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:
zoraaver 2023-09-22 02:11:25 +01:00 committed by GitHub
parent 0677288f22
commit 06527f724e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);