From 235907bd7fce70347ab33dd0a915eac79eae8c0c Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 2 Nov 2023 00:33:51 +0900 Subject: [PATCH] Use libc::strerror_r instead of our own definition (#85) --- src/unix.rs | 8 +------- src/wasi.rs | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/unix.rs b/src/unix.rs index 86a35d9..cc426f1 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -13,7 +13,7 @@ // except according to those terms. use core::str; -use libc::{self, c_char, c_int, size_t, strlen}; +use libc::{self, c_int, size_t, strerror_r, strlen}; use crate::Errno; @@ -86,10 +86,4 @@ extern "C" { #[cfg_attr(target_os = "aix", link_name = "_Errno")] #[cfg_attr(target_os = "nto", link_name = "__get_errno_ptr")] fn errno_location() -> *mut c_int; - - #[cfg_attr( - any(target_os = "linux", target_os = "hurd"), - link_name = "__xpg_strerror_r" - )] - fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int; } diff --git a/src/wasi.rs b/src/wasi.rs index b18fa9b..745ccba 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -13,7 +13,7 @@ // except according to those terms. use core::str; -use libc::{self, c_char, c_int, size_t, strlen}; +use libc::{self, c_int, size_t, strerror_r, strlen}; use crate::Errno; @@ -56,5 +56,4 @@ pub fn set_errno(Errno(new_errno): Errno) { extern "C" { fn __errno_location() -> *mut c_int; - fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int; }