diff --git a/src/netbsd.rs b/src/netbsd.rs index 0ad20b71..c4ea75e4 100644 --- a/src/netbsd.rs +++ b/src/netbsd.rs @@ -29,7 +29,7 @@ static GETRANDOM: LazyPtr = LazyPtr::new(); fn dlsym_getrandom() -> *mut c_void { static NAME: &[u8] = b"getrandom\0"; - let name_ptr = NAME.as_ptr() as *const libc::c_char; + let name_ptr = NAME.as_ptr().cast::(); unsafe { libc::dlsym(libc::RTLD_DEFAULT, name_ptr) } } diff --git a/src/util_libc.rs b/src/util_libc.rs index 7abd590f..1d6bf9a2 100644 --- a/src/util_libc.rs +++ b/src/util_libc.rs @@ -74,7 +74,10 @@ pub fn sys_fill_exact( pub unsafe fn open_readonly(path: &str) -> Result { debug_assert_eq!(path.as_bytes().last(), Some(&0)); loop { - let fd = libc::open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC); + let fd = libc::open( + path.as_ptr().cast::(), + libc::O_RDONLY | libc::O_CLOEXEC, + ); if fd >= 0 { return Ok(fd); }