From 51a6b069d215133fe6a13a1488438071319368be Mon Sep 17 00:00:00 2001 From: Gavin Hayes Date: Fri, 27 Oct 2023 02:07:16 -0400 Subject: [PATCH] Fix use getrandom on cosmopolitan libc (#2674) Fixes the Cosmopolitan Libc platform attempting to use `/dev/urandom` on operating systems that do not have it. Signed-off-by: G4Vi --- .../libc-wasi/sandboxed-system-primitives/src/ssp_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h index a69d6ca38..6a1db8690 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/ssp_config.h @@ -26,8 +26,8 @@ // On Linux, prefer to use getrandom, though it isn't available in // GLIBC before 2.25. -#if (defined(__linux__) || defined(ESP_PLATFORM)) \ - && (!defined(__GLIBC__) || __GLIBC__ > 2 \ +#if (defined(__linux__) || defined(ESP_PLATFORM) || defined(__COSMOPOLITAN__)) \ + && (!defined(__GLIBC__) || __GLIBC__ > 2 \ || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25)) #define CONFIG_HAS_GETRANDOM 1 #else