about summary refs log tree commit diff
path: root/library/std/src/sys/unix
diff options
context:
space:
mode:
authorLinkTed <LinkTed@users.noreply.github.com>2020-09-22 13:18:06 +0200
committerLinkTed <LinkTed@users.noreply.github.com>2020-10-10 15:19:13 +0200
commit31e6e3896d45c82cf1c80aadc87cebe387340ad4 (patch)
tree3789494acee2b4fa65a03e32ac66199e1c22d215 /library/std/src/sys/unix
parentb01ce2cfd0e0182384cffe7db0c0b94c3414c610 (diff)
downloadrust-31e6e3896d45c82cf1c80aadc87cebe387340ad4.tar.gz
rust-31e6e3896d45c82cf1c80aadc87cebe387340ad4.zip
Fix `SO_PASSCRED` for macos
Diffstat (limited to 'library/std/src/sys/unix')
-rw-r--r--library/std/src/sys/unix/net.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs
index 8f28c75641f..f27786dbf79 100644
--- a/library/std/src/sys/unix/net.rs
+++ b/library/std/src/sys/unix/net.rs
@@ -341,10 +341,12 @@ impl Socket {
         Ok(raw != 0)
     }
 
+    #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))]
     pub fn set_passcred(&self, passcred: bool) -> io::Result<()> {
         setsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED, passcred as libc::c_int)
     }
 
+    #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))]
     pub fn passcred(&self) -> io::Result<bool> {
         let passcred: libc::c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED)?;
         Ok(passcred != 0)