From 959af70ee832299101826a5bda41cb99cb7cd50d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 5 Feb 2023 15:10:16 -0500 Subject: this isn't actually a useful safe wrapper it doesn't enforce any invariants --- src/sys.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/sys.rs b/src/sys.rs index 244a43d..272255f 100644 --- a/src/sys.rs +++ b/src/sys.rs @@ -102,7 +102,10 @@ impl Pts { let pts_fd = self.0.as_raw_fd(); move || { nix::unistd::setsid()?; - set_controlling_terminal(pts_fd)?; + // Safety: Pts is required to contain a valid file descriptor + unsafe { + set_controlling_terminal_unsafe(pts_fd, std::ptr::null()) + }?; Ok(()) } } @@ -120,12 +123,6 @@ impl std::os::unix::io::AsRawFd for Pts { } } -fn set_controlling_terminal(fd: std::os::unix::io::RawFd) -> nix::Result<()> { - // Safety: Pts is required to contain a valid file descriptor - unsafe { set_controlling_terminal_unsafe(fd, std::ptr::null()) } - .map(|_| ()) -} - nix::ioctl_write_ptr_bad!( set_term_size_unsafe, libc::TIOCSWINSZ, -- cgit v1.2.3-54-g00ecf