Skip to content

Commit

Permalink
Fix errno on DragonFly
Browse files Browse the repository at this point in the history
__dfly_error has long been removed from the Rust souce.
  • Loading branch information
mneumann authored and lambda-fairy committed May 2, 2018
1 parent a051c9c commit f56ecf2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ libc = "0.2"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["errhandlingapi", "minwindef", "ntdef", "winbase"] }

[target.'cfg(target_os="dragonfly")'.dependencies]
errno-dragonfly = "0.1.1"

[badges]
appveyor = { repository = "lfairy/rust-errno" }
travis-ci = { repository = "lfairy/rust-errno" }
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#[cfg(unix)] extern crate libc;
#[cfg(windows)] extern crate winapi;
#[cfg(target_os = "dragonfly")] extern crate errno_dragonfly;

// FIXME(#10): Rust < 1.11 doesn't support cfg_attr on path
/*
Expand Down
5 changes: 3 additions & 2 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

use std::ffi::CStr;
use libc::{self, c_char, c_int};
#[cfg(target_os = "dragonfly")]
use errno_dragonfly::errno_location;

use Errno;

Expand Down Expand Up @@ -48,12 +50,11 @@ pub fn set_errno(Errno(errno): Errno) {
}

extern {
#[cfg(not(target_os = "dragonfly"))]
#[cfg_attr(any(target_os = "macos",
target_os = "ios",
target_os = "freebsd"),
link_name = "__error")]
#[cfg_attr(target_os = "dragonfly",
link_name = "__dfly_error")]
#[cfg_attr(any(target_os = "openbsd", target_os = "bitrig", target_os = "android"),
link_name = "__errno")]
#[cfg_attr(target_os = "solaris",
Expand Down

0 comments on commit f56ecf2

Please sign in to comment.