Skip to content

Commit

Permalink
fix wasi
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Oct 9, 2024
1 parent 9c86f06 commit 86a610c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
let ret = unsafe { random_get(dest.as_mut_ptr() as i32, dest.len() as i32) };
match ret {
0 => Ok(()),
code => u32::try_from(code)
.map(Error::from_os_error)
.unwrap_or(Error::UNEXPECTED),
code => {
let err = u32::try_from(code)
.map(Error::from_os_error)
.unwrap_or(Error::UNEXPECTED);
Err(err)
}
}
}

Expand Down

0 comments on commit 86a610c

Please sign in to comment.