diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-02-05 15:10:16 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-02-05 15:10:16 -0500 |
commit | 959af70ee832299101826a5bda41cb99cb7cd50d (patch) | |
tree | 5a2c4649dd67a32df71987bc996c9fac1d3659ec | |
parent | 9656f9f0382e508c4e9d35f160a7a9e6923f66f3 (diff) | |
download | pty-process-959af70ee832299101826a5bda41cb99cb7cd50d.tar.gz pty-process-959af70ee832299101826a5bda41cb99cb7cd50d.zip |
this isn't actually a useful safe wrapper
it doesn't enforce any invariants
-rw-r--r-- | src/sys.rs | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -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, |