Fix getrandom syscall checking
Test: angler
Bug: 32838381
(cherry-picked from commit 46289b4c0211fc48d8719b385a7e56d765510ebd)
Change-Id: I102ffa26d7f39a8d3572b31f04b66ae31a9e752c
diff --git a/libc/bionic/bionic_arc4random.cpp b/libc/bionic/bionic_arc4random.cpp
index d20cb68..429ff7f 100644
--- a/libc/bionic/bionic_arc4random.cpp
+++ b/libc/bionic/bionic_arc4random.cpp
@@ -38,7 +38,7 @@
#include "private/libc_logging.h"
void __libc_safe_arc4random_buf(void* buf, size_t n, KernelArgumentBlock& args) {
- static bool have_getrandom = syscall(SYS_getrandom, nullptr, 0, 0) == -1 && errno != ENOSYS;
+ static bool have_getrandom = syscall(SYS_getrandom, nullptr, 0, 0) != -1 || errno != ENOSYS;
static bool have_urandom = access("/dev/urandom", R_OK) == 0;
static size_t at_random_bytes_consumed = 0;