diff --git a/src/linux_rustix.rs b/src/linux_rustix.rs index 30a6496c..babbad99 100644 --- a/src/linux_rustix.rs +++ b/src/linux_rustix.rs @@ -22,7 +22,7 @@ pub fn getrandom_inner(mut dest: &mut [MaybeUninit]) -> Result<(), Error> { .raw_os_error() .wrapping_neg() .try_into() - .expect("Errno uses u16 internally"); + .map_err(|_| Error::UNEXPECTED)?; return Err(Error::from_os_error(code)); } }