Skip to content

Commit

Permalink
Auto merge of #253 - nodakai:strerror_r, r=alexcrichton
Browse files Browse the repository at this point in the history
On non-musl Linux, strerror_r should be linked to __xpg_strerror_r

Currently `libc::strerror_r()` wrongly returns a `c_char` pointer as a large `c_int`.

Also exclude `MS_RMT_MASK` from `libc-test`.
  • Loading branch information
bors committed Apr 3, 2016
2 parents 46cca7a + 4d1efd9 commit fb2f0bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ fn main() {

// weird signed extension or something like that?
"MS_NOUSER" => true,
"MS_RMT_MASK" => true, // updated in glibc 2.22 and musl 1.1.13

// These OSX constants are flagged as deprecated
"NOTE_EXIT_REPARENTED" |
Expand Down
4 changes: 2 additions & 2 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ extern {
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
oldset: *mut sigset_t) -> ::c_int;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;

// #[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")]
#[cfg_attr(all(target_os = "linux", not(target_env = "musl")),
link_name = "__xpg_strerror_r")]
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
buflen: ::size_t) -> ::c_int;

Expand Down

0 comments on commit fb2f0bb

Please sign in to comment.