mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-01 07:13:24 +03:00
switch from syscall(2) to getentropy(2)
use the `getentropy()` function instead of `syscall()` and syscall-numbers.
This commit is contained in:
@@ -222,7 +222,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
|
||||
// getentropy(2) permits a maximum buffer size of 256 bytes
|
||||
for s in v.chunks_mut(256) {
|
||||
let ret = unsafe {
|
||||
libc::syscall(libc::NR_GETENTROPY, s.as_mut_ptr(), s.len())
|
||||
libc::getentropy(s.as_mut_ptr() as *mut libc::c_void, s.len())
|
||||
};
|
||||
if ret == -1 {
|
||||
panic!("unexpected getentropy error: {}", errno());
|
||||
|
||||
Reference in New Issue
Block a user