From 9c583eb910963bbc9ded2daa9ed93ff31beab11f Mon Sep 17 00:00:00 2001 From: Daan Date: Sun, 16 Jan 2022 12:10:33 -0800 Subject: [PATCH] fix return code check on syscall (issue #524) --- src/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/random.c b/src/random.c index e47946a6..0b44c8b9 100644 --- a/src/random.c +++ b/src/random.c @@ -239,7 +239,7 @@ static bool os_random_buf(void* buf, size_t buf_len) { if (mi_atomic_load_acquire(&no_getrandom)==0) { ssize_t ret = syscall(SYS_getrandom, buf, buf_len, GRND_NONBLOCK); if (ret >= 0) return (buf_len == (size_t)ret); - if (ret != ENOSYS) return false; + if (errno != ENOSYS) return false; mi_atomic_store_release(&no_getrandom, 1UL); // don't call again, and fall back to /dev/urandom } #endif