From 13f6dfbe53243d019eff4733f24d28e55f8ce6d8 Mon Sep 17 00:00:00 2001 From: Xing Xue Date: Fri, 8 Aug 2025 13:17:29 -0400 Subject: [PATCH] Change the cfmakeraw() wrapper to handle the difference in its return type on AIX. --- src/backend/libc/termios/syscalls.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/backend/libc/termios/syscalls.rs b/src/backend/libc/termios/syscalls.rs index e27f0b2e0..dbe4a6e03 100644 --- a/src/backend/libc/termios/syscalls.rs +++ b/src/backend/libc/termios/syscalls.rs @@ -493,7 +493,20 @@ pub(crate) fn set_input_speed(termios: &mut Termios, arbitrary_speed: u32) -> io #[cfg(not(any(target_os = "espidf", target_os = "nto", target_os = "wasi")))] #[inline] pub(crate) fn cfmakeraw(termios: &mut Termios) { - unsafe { c::cfmakeraw(as_mut_ptr(termios).cast()) } + unsafe { + // On AIX, cfmakeraw() has a return type of 'int' instead of 'void'. + // If the argument 'termios' is NULL, it returns -1; otherwise, it returns 0. + // We believe it is safe to ignore the return value. + #[cfg(target_os = "aix")] + { + let _ = c::cfmakeraw(as_mut_ptr(termios).cast()); + } + + #[cfg(not(target_os = "aix"))] + { + c::cfmakeraw(as_mut_ptr(termios).cast()); + } + } } pub(crate) fn isatty(fd: BorrowedFd<'_>) -> bool {