[libc-commits] [libc] [libc] Internal getrandom implementation (PR #144427)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Tue Jun 17 09:39:34 PDT 2025
================
@@ -19,13 +20,12 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(ssize_t, getrandom,
(void *buf, size_t buflen, unsigned int flags)) {
- ssize_t ret =
- LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_getrandom, buf, buflen, flags);
- if (ret < 0) {
- libc_errno = static_cast<int>(-ret);
+ auto rand = internal::getrandom(buf, buflen, flags);
+ if (rand.error()) {
----------------
michaelrj-google wrote:
same here
```suggestion
if (!rand.has_value()) {
```
https://github.com/llvm/llvm-project/pull/144427
More information about the libc-commits
mailing list