From 7d0127fa251634424316205d4e6b82b3313f2305 Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Tue, 11 Aug 2020 16:01:19 -0700 Subject: [PATCH] use subordinate terminal device for termios calls The pseudo-terminal device handling tests in some places make tcgetattr(3C) and tcsetattr(3C) calls using the control/manager file descriptor rather than the subordinate terminal descriptor. This works on some systems, but not all; others such as illumos (and presumably Solaris) are more strict and require the termios requests be made against the terminal descriptor only. --- test/sys/test_termios.rs | 6 +++--- test/test_pty.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/sys/test_termios.rs b/test/sys/test_termios.rs index 4fa6df9b29..00aeb2fc57 100644 --- a/test/sys/test_termios.rs +++ b/test/sys/test_termios.rs @@ -22,7 +22,7 @@ fn test_tcgetattr_pty() { let _m = crate::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test"); let pty = openpty(None, None).expect("openpty failed"); - assert!(termios::tcgetattr(pty.master).is_ok()); + assert!(termios::tcgetattr(pty.slave).is_ok()); close(pty.master).expect("closing the master failed"); close(pty.slave).expect("closing the slave failed"); } @@ -53,7 +53,7 @@ fn test_output_flags() { let pty = openpty(None, None).expect("openpty failed"); assert!(pty.master > 0); assert!(pty.slave > 0); - let termios = tcgetattr(pty.master).expect("tcgetattr failed"); + let termios = tcgetattr(pty.slave).expect("tcgetattr failed"); close(pty.master).unwrap(); close(pty.slave).unwrap(); termios @@ -95,7 +95,7 @@ fn test_local_flags() { let pty = openpty(None, None).unwrap(); assert!(pty.master > 0); assert!(pty.slave > 0); - let termios = tcgetattr(pty.master).unwrap(); + let termios = tcgetattr(pty.slave).unwrap(); close(pty.master).unwrap(); close(pty.slave).unwrap(); termios diff --git a/test/test_pty.rs b/test/test_pty.rs index 1e0858770e..ab347bb040 100644 --- a/test/test_pty.rs +++ b/test/test_pty.rs @@ -205,7 +205,7 @@ fn test_openpty_with_termios() { let pty = openpty(None, None).unwrap(); assert!(pty.master > 0); assert!(pty.slave > 0); - let termios = tcgetattr(pty.master).unwrap(); + let termios = tcgetattr(pty.slave).unwrap(); close(pty.master).unwrap(); close(pty.slave).unwrap(); termios