aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2023-02-05 15:10:16 -0500
committerJesse Luehrs <doy@tozt.net>2023-02-05 15:10:16 -0500
commit959af70ee832299101826a5bda41cb99cb7cd50d (patch)
tree5a2c4649dd67a32df71987bc996c9fac1d3659ec
parent9656f9f0382e508c4e9d35f160a7a9e6923f66f3 (diff)
downloadpty-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.rs11
1 files changed, 4 insertions, 7 deletions
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,