Skip to content

Commit 57c0a2c

Browse files
author
Sriya Pratipati
committed
style changes
1 parent 411fd43 commit 57c0a2c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

libc/src/__support/HashTable/randomness.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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;

libc/src/sys/random/linux/getrandom.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ namespace LIBC_NAMESPACE_DECL {
2121
LLVM_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

0 commit comments

Comments
 (0)