Fix su with tty

This commit is contained in:
LoveSy
2025-02-01 14:45:47 +08:00
committed by John Wu
parent 15dca29a87
commit 58a25a3e2b

View File

@@ -137,7 +137,11 @@ impl UnixSocketExt for UnixStream {
pub fn send_fd(socket: RawFd, fd: RawFd) -> bool {
let mut socket = ManuallyDrop::new(unsafe { UnixStream::from_raw_fd(socket) });
socket.send_fds(&[fd]).log().is_ok()
if fd < 0 {
socket.send_fds(&[]).log().is_ok()
} else {
socket.send_fds(&[fd]).log().is_ok()
}
}
pub fn send_fds(socket: RawFd, fds: &[RawFd]) -> bool {