From 4b7334eff4b8ee2779d49576dff59b6f923c5969 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 21 Apr 2025 16:13:04 -0500 Subject: [PATCH] getentropy() added to android API 28 in 2018: not quite 7 years yet. --- lib/portability.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portability.c b/lib/portability.c index b541c5d9..6acb0ec7 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -38,7 +38,7 @@ void xgetrandom(void *buf, unsigned buflen) // BSD/macOS only has getentropy(), but it's in (to be fair, // they were there first). getrandom() and getentropy() both went into glibc // in the same release (2.25 in 2017), so this test still works. -#if __has_include() +#if __has_include() && (!defined(__ANDROID__) || __ANDROID_API__>28) while (buflen) { if (getentropy(buf, fd = buflen>256 ? 256 : buflen)) break; buflen -= fd;