This repository has been archived by the owner. It is now read-only.

Fix build on DragonFly #26

Merged
merged 1 commit into from Jan 11, 2018
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+4 −2
Diff settings

Always

Just for now

Fix build on DragonFly

Note that DragonFly does not (yet) support SO_PEERCRED. Anyhow,
we use the same code here as MacOS and FreeBSD. The result is a
Result::Err at runtime when being called. Alternatively
UnixStream#peer_cred could be conditionally removed on DragonFly.
  • Loading branch information...
mneumann committed Jan 11, 2018
commit 0be79e653a58ee12defb09cec67cb0c7f3750815
Copy path View file
@@ -12,7 +12,7 @@ pub struct UCred {
#[cfg(target_os = "linux")]
pub use self::impl_linux::get_peer_cred;

#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]
#[cfg(any(target_os = "dragonfly", target_os = "macos", target_os = "ios", target_os = "freebsd"))]
pub use self::impl_macos::get_peer_cred;

#[cfg(target_os = "linux")]
@@ -51,7 +51,7 @@ pub mod impl_linux {
}
}

#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]
#[cfg(any(target_os = "dragonfly", target_os = "macos", target_os = "ios", target_os = "freebsd"))]
pub mod impl_macos {
use libc::getpeereid;
use std::{io, mem};
@@ -75,6 +75,8 @@ pub mod impl_macos {
}
}

// Note that SO_PEERCRED is not supported on DragonFly (yet). So do not run tests.
#[cfg(not(target_os = "dragonfly"))]
#[cfg(test)]
mod test {
use tokio_core::reactor::Core;
ProTip! Use n and p to navigate between commits in a pull request.