From 02953c28127ece6a919e43f607ff5dbd442c6de0 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Mon, 8 Jan 2018 22:49:01 +0000 Subject: [PATCH] Fix `ioctl` call failing on 32 bit architecture (#1011) --- src/tty.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tty.rs b/src/tty.rs index aea2691f..21c9659d 100644 --- a/src/tty.rs +++ b/src/tty.rs @@ -113,10 +113,12 @@ fn openpty(rows: u8, cols: u8) -> (c_int, c_int) { /// Really only needed on BSD, but should be fine elsewhere fn set_controlling_terminal(fd: c_int) { let res = unsafe { - // Cross platform issue because on linux this is u64 as u64 (does nothing) - // But on macos this is u32 as u64, asking for u64::from(u32) + // TIOSCTTY changes based on platform and the `ioctl` call is different + // based on architecture (32/64). So a generic cast is used to make sure + // there are no issues. To allow such a generic cast the clippy warning + // is disabled. #[cfg_attr(feature = "clippy", allow(cast_lossless))] - libc::ioctl(fd, TIOCSCTTY as u64, 0) + libc::ioctl(fd, TIOCSCTTY as _, 0) }; if res < 0 {