Skip to content

Commit

Permalink
panic in netbsd
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Oct 16, 2024
1 parent f0a58de commit 02824b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/linux_android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ compile_error!("`linux_getrandom` backend can be enabled only for Linux/Android

pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
util_libc::sys_fill_exact(dest, |buf| unsafe {
let ret = libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0);
if ret == 42 {
todo!();
}
ret
libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0)
})
}
6 changes: 5 additions & 1 deletion src/netbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
}
let fptr = unsafe { mem::transmute::<*mut c_void, GetRandomFn>(fptr) };
sys_fill_exact(dest, |buf| unsafe {
fptr(buf.as_mut_ptr().cast::<c_void>(), buf.len(), 0)
let ret = fptr(buf.as_mut_ptr().cast::<c_void>(), buf.len(), 0);
if ret == 42 {
todo!();
}
ret
})
}

0 comments on commit 02824b9

Please sign in to comment.