From 565a80557761690baf0158c6a38de38ceeb3bad5 Mon Sep 17 00:00:00 2001 From: Aditya K <41550011+adityuhkapoor@users.noreply.github.com> Date: Sun, 25 Oct 2026 21:34:39 -0400 Subject: [PATCH] Pass zero as the TIOCSCTTY argument --- src/process/ioctl.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/process/ioctl.rs b/src/process/ioctl.rs index e0ba00187..94e4c1318 100644 --- a/src/process/ioctl.rs +++ b/src/process/ioctl.rs @@ -18,7 +18,7 @@ use backend::fd::AsFd; /// - [NetBSD] /// - [OpenBSD] /// -/// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html +/// [Linux]: https://man7.org/linux/man-pages/man2/TIOCSCTTY.2const.html /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4 /// [NetBSD]: https://man.netbsd.org/tty.4 /// [OpenBSD]: https://man.openbsd.org/tty.4 @@ -43,7 +43,7 @@ unsafe impl ioctl::Ioctl for Tiocsctty { } fn as_ptr(&mut self) -> *mut c::c_void { - crate::utils::as_ptr(&0_u32) as *mut c::c_void + core::ptr::null_mut() } unsafe fn output_from_ptr( @@ -53,3 +53,11 @@ unsafe impl ioctl::Ioctl for Tiocsctty { Ok(()) } } + +#[test] +#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))] +fn tiocsctty_argument_is_zero() { + use crate::ioctl::Ioctl; + + assert!(Tiocsctty.as_ptr().is_null()); +}