diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c index ba615a720527b..1d15b881ed111 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getrandom.c @@ -3,6 +3,7 @@ // #include +#include #if !defined(__GLIBC_PREREQ) #define __GLIBC_PREREQ(a, b) 0 @@ -21,6 +22,8 @@ int main() { ssize_t n = 1; #if defined(HAS_GETRANDOM) n = getrandom(buf, sizeof(buf), 0); + if (n == -1 && errno == ENOSYS) + n = 1; #endif return (int)(n <= 0); }