File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ LIBC_INLINE uint64_t next_random_seed() {
4040 uint8_t *buffer = reinterpret_cast <uint8_t *>(entropy);
4141 while (count > 0 ) {
4242 auto len = internal::getrandom (buffer, count, 0 );
43- if (! len.has_value ()) {
43+ if (len.error ()) {
4444 if (libc_errno == ENOSYS)
4545 break ;
4646 continue ;
Original file line number Diff line number Diff line change @@ -21,10 +21,11 @@ namespace LIBC_NAMESPACE_DECL {
2121LLVM_LIBC_FUNCTION (ssize_t , getrandom,
2222 (void *buf, size_t buflen, unsigned int flags)) {
2323 auto rand = internal::getrandom (buf, buflen, flags);
24- if (rand.has_value ())
25- return rand.value ();
26- libc_errno = static_cast <int >(rand.error ());
27- return -1 ;
24+ if (rand.error ()) {
25+ libc_errno = static_cast <int >(rand.error ());
26+ return -1 ;
27+ }
28+ return rand.value ();
2829}
2930
3031} // namespace LIBC_NAMESPACE_DECL
You can’t perform that action at this time.
0 commit comments