Skip to content

Commit fb2f0bb

Browse files
committed
Auto merge of #253 - nodakai:strerror_r, r=alexcrichton
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`.
2 parents 46cca7a + 4d1efd9 commit fb2f0bb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ fn main() {
312312

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

316317
// These OSX constants are flagged as deprecated
317318
"NOTE_EXIT_REPARENTED" |

src/unix/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,8 @@ extern {
506506
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
507507
oldset: *mut sigset_t) -> ::c_int;
508508
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
509-
510-
// #[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")]
509+
#[cfg_attr(all(target_os = "linux", not(target_env = "musl")),
510+
link_name = "__xpg_strerror_r")]
511511
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
512512
buflen: ::size_t) -> ::c_int;
513513

0 commit comments

Comments
 (0)