Skip to content

Commit 0911a4e

Browse files
authored
Merge pull request #629 from samueltardieu/issue-610
Use syscall from libc on Linux instead of redefining it
2 parents ad8410e + 92009af commit 0911a4e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/rngs/os.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,16 +426,13 @@ mod imp {
426426
const NR_GETRANDOM: libc::c_long = 0;
427427

428428
fn getrandom(buf: &mut [u8], blocking: bool) -> libc::c_long {
429-
extern "C" {
430-
fn syscall(number: libc::c_long, ...) -> libc::c_long;
431-
}
432429
const GRND_NONBLOCK: libc::c_uint = 0x0001;
433430

434431
if NR_GETRANDOM == 0 { return -1 };
435432

436433
unsafe {
437-
syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(),
438-
if blocking { 0 } else { GRND_NONBLOCK })
434+
libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(),
435+
if blocking { 0 } else { GRND_NONBLOCK })
439436
}
440437
}
441438

0 commit comments

Comments
 (0)