Fix SO_PASSCRED
for macos
This commit is contained in:
parent
b01ce2cfd0
commit
31e6e3896d
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue