Skip to content

Commit c8aa82d

Browse files
committed
Fixed casts in the test
1 parent 2e8f82d commit c8aa82d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/pass-dep/libc/prctl.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@only-target: android # prctl is currently supported for Android only
22
use std::ffi::CStr;
33
use std::ffi::CString;
4+
use libc::c_char;
45

56
fn main() {
67
let long_name = CString::new(
@@ -24,7 +25,7 @@ fn main() {
2425
fn set_thread_name(name: &CStr) -> i32 {
2526
cfg_if::cfg_if! {
2627
if #[cfg(any(target_os = "android"))] {
27-
unsafe { libc::prctl(libc::PR_SET_NAME, name.as_ptr().cast()) }
28+
unsafe { libc::prctl(libc::PR_SET_NAME, name.as_ptr().cast::<*const c_char>()) }
2829
} else {
2930
compile_error!("set_thread_name not supported for this OS")
3031
}
@@ -37,7 +38,7 @@ fn get_thread_name(name: &mut [u8]) -> i32 {
3738
target_os = "android",
3839
))] {
3940
unsafe {
40-
libc::prctl(libc::PR_GET_NAME, name.as_mut_ptr().cast())
41+
libc::prctl(libc::PR_GET_NAME, name.as_mut_ptr().cast::<*mut c_char>())
4142
}
4243
} else {
4344
compile_error!("get_thread_name not supported for this OS")

0 commit comments

Comments
 (0)