Skip to content

Commit

Permalink
Merge #1290
Browse files Browse the repository at this point in the history
1290: use subordinate terminal device for termios calls r=asomers a=jclulow

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.

Co-authored-by: Joshua M. Clulow <jmc@oxide.computer>
  • Loading branch information
bors[bot] and jclulow authored Sep 6, 2020
2 parents 645309d + 7d0127f commit bf77f50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/sys/test_termios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_pty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bf77f50

Please sign in to comment.