libc-wasi: Make rights of STDIN/STDOUT/STDERR fixed and overlook their access modes (#3694)

When determining the file descriptor rights in the function fd_determine_type_rights(),
we assign fixed and unchangeable rights to STDIN, STDOUT and STDERR.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3686
This commit is contained in:
liang.he
2024-08-13 10:10:22 +08:00
committed by GitHub
parent 140ff25d46
commit 67fa155878
6 changed files with 138 additions and 19 deletions

View File

@ -1540,6 +1540,24 @@ create_stdio_handle(HANDLE raw_stdio_handle, DWORD stdio)
return stdio_handle;
}
bool
os_is_stdin_handle(os_file_handle fd)
{
return fd->raw.handle == GetStdHandle(STD_INPUT_HANDLE);
}
bool
os_is_stdout_handle(os_file_handle fd)
{
return fd->raw.handle == GetStdHandle(STD_OUTPUT_HANDLE);
}
bool
os_is_stderr_handle(os_file_handle fd)
{
return fd->raw.handle == GetStdHandle(STD_ERROR_HANDLE);
}
os_file_handle
os_convert_stdin_handle(os_raw_file_handle raw_stdin)
{