Skip to content

Commit c3628b0

Browse files
author
Jakub Konka
committed
Do not adjust rights on Stdio
1 parent a4fd811 commit c3628b0

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

crates/wasi-common/src/sys/unix/stdio.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ impl StdioExt for Stdio {
4242
}
4343

4444
fn get_rights(file: &File) -> io::Result<HandleRights> {
45-
use yanix::fcntl;
46-
use yanix::file::{isatty, OFlag};
45+
use yanix::file::isatty;
4746
let (base, inheriting) = {
4847
if unsafe { isatty(file.as_raw_fd())? } {
4948
(types::Rights::tty_base(), types::Rights::tty_base())
@@ -54,13 +53,5 @@ fn get_rights(file: &File) -> io::Result<HandleRights> {
5453
)
5554
}
5655
};
57-
let mut rights = HandleRights::new(base, inheriting);
58-
let flags = unsafe { fcntl::get_status_flags(file.as_raw_fd())? };
59-
let accmode = flags & OFlag::ACCMODE;
60-
if accmode == OFlag::RDONLY {
61-
rights.base &= !types::Rights::FD_WRITE;
62-
} else if accmode == OFlag::WRONLY {
63-
rights.base &= !types::Rights::FD_READ;
64-
}
65-
Ok(rights)
56+
Ok(HandleRights::new(base, inheriting))
6657
}

0 commit comments

Comments
 (0)