Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/pass-dep/libc/libc-strerror_r.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
//@ignore-target: windows # Supported only on unixes

#[path = "../../utils/libc.rs"]
mod libc_utils;
use libc_utils::errno_check;

fn main() {
unsafe {
let mut buf = vec![0u8; 32];
assert_eq!(libc::strerror_r(libc::EPERM, buf.as_mut_ptr().cast(), buf.len()), 0);
errno_check(libc::strerror_r(libc::EPERM, buf.as_mut_ptr().cast(), buf.len()));
let mut buf2 = vec![0u8; 64];
assert_eq!(libc::strerror_r(-1i32, buf2.as_mut_ptr().cast(), buf2.len()), 0);
errno_check(libc::strerror_r(-1i32, buf2.as_mut_ptr().cast(), buf2.len()));
// This buffer is deliberately too small so this triggers ERANGE.
let mut buf3 = vec![0u8; 2];
assert_eq!(
Expand Down