summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Samuelsson <msamuelsson@storvix.eu>2023-07-21 15:39:15 +0200
committerMartin Samuelsson <msamuelsson@storvix.eu>2023-07-21 17:14:04 +0200
commit8e5d9144910efb2b2e9555c7d83270b8c3ca18d7 (patch)
treec21bb86e72b0581fd570fb2f3de2dc9fd48224cd
parentc375a102ac0af0d08c4942ffd81c84b6d6769d08 (diff)
downloadnix-fix/disable_tcsetattr_illumos.zip
Disable tcsetattr() on illumos and solarisfix/disable_tcsetattr_illumos
Calling tcsetattr() as currently done by nix is documented undefined behaviour on illumos, and will always fail. For details, please see: https://github.com/nix-rust/nix/issues/2071
-rw-r--r--src/sys/termios.rs1
-rw-r--r--test/test_pty.rs3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/sys/termios.rs b/src/sys/termios.rs
index af29d64d..0614cb5e 100644
--- a/src/sys/termios.rs
+++ b/src/sys/termios.rs
@@ -1161,6 +1161,7 @@ pub fn tcgetattr<Fd: AsFd>(fd: Fd) -> Result<Termios> {
/// `tcsetattr()` reconfigures the given port based on a given `Termios` structure. This change
/// takes affect at a time specified by `actions`. Note that this function may return success if
/// *any* of the parameters were successfully set, not only if all were set successfully.
+#[cfg(not(any(target_os = "illumos", target_os = "solaris",)))]
pub fn tcsetattr<Fd: AsFd>(
fd: Fd,
actions: SetArg,
diff --git a/test/test_pty.rs b/test/test_pty.rs
index 4cc6620c..7019944b 100644
--- a/test/test_pty.rs
+++ b/test/test_pty.rs
@@ -135,6 +135,7 @@ fn test_open_ptty_pair() {
}
/// Put the terminal in raw mode.
+#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
fn make_raw<Fd: AsFd>(fd: Fd) {
let mut termios = tcgetattr(&fd).unwrap();
cfmakeraw(&mut termios);
@@ -142,6 +143,7 @@ fn make_raw<Fd: AsFd>(fd: Fd) {
}
/// Test `io::Read` on the PTTY master
+#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
#[test]
fn test_read_ptty_pair() {
let (mut master, mut slave) = open_ptty_pair();
@@ -159,6 +161,7 @@ fn test_read_ptty_pair() {
}
/// Test `io::Write` on the PTTY master
+#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
#[test]
fn test_write_ptty_pair() {
let (mut master, mut slave) = open_ptty_pair();