Skip to content

Commit

Permalink
Merge pull request #16 from cpick/fix-noctty
Browse files Browse the repository at this point in the history
Prevent `Pty::pts()` from attaching via `O_NOCTTY`
  • Loading branch information
doy authored Jan 30, 2025
2 parents e863a34 + 349c9ec commit 94a3bca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sys.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::os::{
fd::{AsRawFd as _, FromRawFd as _},
unix::prelude::OsStrExt as _,
unix::prelude::{OpenOptionsExt as _, OsStrExt as _},
};

#[derive(Debug)]
Expand Down Expand Up @@ -33,6 +33,7 @@ impl Pty {
Ok(Pts(std::fs::OpenOptions::new()
.read(true)
.write(true)
.custom_flags(libc::O_NOCTTY)
.open(std::ffi::OsStr::from_bytes(
rustix::pty::ptsname(&self.0, vec![])?.as_bytes(),
))?
Expand Down

0 comments on commit 94a3bca

Please sign in to comment.