diff --git a/Cargo.toml b/Cargo.toml index 3b96e93be..87c9f20bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ os-util = ["os-ext"]# Replaced with "os-ext" feature. log = "0.4.8" [target.'cfg(unix)'.dependencies] -libc = "0.2.82" +libc = "0.2.86" [target.'cfg(windows)'.dependencies] miow = "0.3.6" diff --git a/src/sys/unix/tcp.rs b/src/sys/unix/tcp.rs index 9e1d70069..70986fa69 100644 --- a/src/sys/unix/tcp.rs +++ b/src/sys/unix/tcp.rs @@ -140,6 +140,9 @@ pub(crate) fn set_linger(socket: TcpSocket, dur: Option) -> io::Result syscall!(setsockopt( socket, libc::SOL_SOCKET, + #[cfg(target_vendor = "apple")] + libc::SO_LINGER_SEC, + #[cfg(not(target_vendor = "apple"))] libc::SO_LINGER, &val as *const libc::linger as *const libc::c_void, size_of::() as libc::socklen_t, @@ -154,6 +157,9 @@ pub(crate) fn get_linger(socket: TcpSocket) -> io::Result> { syscall!(getsockopt( socket, libc::SOL_SOCKET, + #[cfg(target_vendor = "apple")] + libc::SO_LINGER_SEC, + #[cfg(not(target_vendor = "apple"))] libc::SO_LINGER, &mut val as *mut _ as *mut _, &mut len,