summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/backend/libc/rand
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/rustix/src/backend/libc/rand
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/backend/libc/rand')
-rw-r--r--vendor/rustix/src/backend/libc/rand/syscalls.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/vendor/rustix/src/backend/libc/rand/syscalls.rs b/vendor/rustix/src/backend/libc/rand/syscalls.rs
index ce1746055..2dcff139e 100644
--- a/vendor/rustix/src/backend/libc/rand/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/rand/syscalls.rs
@@ -1,7 +1,7 @@
//! libc syscalls supporting `rustix::rand`.
#[cfg(any(target_os = "android", target_os = "linux"))]
-use {super::super::c, super::super::conv::ret_ssize_t, crate::io, crate::rand::GetRandomFlags};
+use {super::super::c, super::super::conv::ret_usize, crate::io, crate::rand::GetRandomFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> {
@@ -10,7 +10,5 @@ pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usi
fn getrandom(buf: *mut c::c_void, buflen: c::size_t, flags: c::c_uint) via SYS_getrandom -> c::ssize_t
}
- let nread =
- unsafe { ret_ssize_t(getrandom(buf.as_mut_ptr().cast(), buf.len(), flags.bits()))? };
- Ok(nread as usize)
+ unsafe { ret_usize(getrandom(buf.as_mut_ptr().cast(), buf.len(), flags.bits())) }
}