Fix `ioctl` call failing on 32 bit architecture (#1011)
This commit is contained in:
parent
bd9123e7df
commit
02953c2812
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue