Skip to content

Commit 31e6e38

Browse files
committed
Fix SO_PASSCRED for macos
1 parent b01ce2c commit 31e6e38

File tree

1 file changed

+2
-0
lines changed
  • library/std/src/sys/unix

1 file changed

+2
-0
lines changed

library/std/src/sys/unix/net.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,12 @@ impl Socket {
341341
Ok(raw != 0)
342342
}
343343

344+
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))]
344345
pub fn set_passcred(&self, passcred: bool) -> io::Result<()> {
345346
setsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED, passcred as libc::c_int)
346347
}
347348

349+
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))]
348350
pub fn passcred(&self) -> io::Result<bool> {
349351
let passcred: libc::c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED)?;
350352
Ok(passcred != 0)

0 commit comments

Comments
 (0)