Skip to content

Commit bc6a5c7

Browse files
committed
std: getrandom simplification for freebsd.
it is in the libcs' crate too now.
1 parent 5ea6256 commit bc6a5c7

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

library/std/src/sys/unix/rand.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,7 @@ mod imp {
6464

6565
#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "freebsd"))]
6666
fn getrandom(buf: &mut [u8]) -> libc::ssize_t {
67-
#[cfg(not(target_os = "freebsd"))]
68-
use libc::getrandom;
69-
#[cfg(target_os = "freebsd")]
70-
extern "C" {
71-
fn getrandom(
72-
buf: *mut libc::c_void,
73-
buflen: libc::size_t,
74-
flags: libc::c_uint,
75-
) -> libc::ssize_t;
76-
}
77-
unsafe { getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
67+
unsafe { libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }
7868
}
7969

8070
#[cfg(not(any(

0 commit comments

Comments
 (0)