Skip to content

Commit

Permalink
Use libc::strerror_r instead of our own definition (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Nov 1, 2023
1 parent 9928bb1 commit 235907b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
8 changes: 1 addition & 7 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
3 changes: 1 addition & 2 deletions src/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

0 comments on commit 235907b

Please sign in to comment.