Skip to content

Commit

Permalink
add safety comments
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats committed Oct 19, 2024
1 parent 8f3614f commit 1054084
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime/ops/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ fn op_set_raw(
let tty_mode_store = state.borrow::<TtyModeStore>().clone();
let previous_mode = tty_mode_store.get(rid);

// SAFETY: Nix crate requires value to implement the AsFd trait
let raw_fd = unsafe { std::os::fd::BorrowedFd::borrow_raw(handle_or_fd) };

if is_raw {
Expand Down
1 change: 1 addition & 0 deletions tests/util/server/src/pty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ fn setup_pty(fd: i32) {
use nix::sys::termios::tcsetattr;
use nix::sys::termios::SetArg;

// SAFETY: Nix crate requires value to implement the AsFd trait
let as_fd = unsafe { std::os::fd::BorrowedFd::borrow_raw(fd) };

let mut term = tcgetattr(as_fd).unwrap();
Expand Down

0 comments on commit 1054084

Please sign in to comment.