Skip to content

Commit 03a40b3

Browse files
author
Adam Barth
committed
Update zx_cprng_draw_new on Fuchsia
Fuchsia is changing the semantics for zx_cprng_draw and zx_cprng_draw_new is a temporary name for the new semantics.
1 parent a646c91 commit 03a40b3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/libstd/sys/unix/rand.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,14 @@ mod imp {
183183
mod imp {
184184
#[link(name = "zircon")]
185185
extern {
186-
fn zx_cprng_draw(buffer: *mut u8, len: usize, actual: *mut usize) -> i32;
186+
fn zx_cprng_draw_new(buffer: *mut u8, len: usize) -> i32;
187187
}
188188

189189
fn getrandom(buf: &mut [u8]) -> Result<usize, i32> {
190190
unsafe {
191-
let mut actual = 0;
192-
let status = zx_cprng_draw(buf.as_mut_ptr(), buf.len(), &mut actual);
191+
let status = zx_cprng_draw_new(buf.as_mut_ptr(), buf.len());
193192
if status == 0 {
194-
Ok(actual)
193+
Ok(buf.len())
195194
} else {
196195
Err(status)
197196
}

0 commit comments

Comments
 (0)