forked from OSchip/llvm-project
[sanitizer] Assume getrandom might not be supported by the kernel
It was added on kernel 3.17.
This commit is contained in:
parent
7b0ca32b62
commit
0ad3cb8c26
compiler-rt/test/sanitizer_common/TestCases/Posix
|
@ -3,6 +3,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#if !defined(__GLIBC_PREREQ)
|
#if !defined(__GLIBC_PREREQ)
|
||||||
#define __GLIBC_PREREQ(a, b) 0
|
#define __GLIBC_PREREQ(a, b) 0
|
||||||
|
@ -21,6 +22,8 @@ int main() {
|
||||||
ssize_t n = 1;
|
ssize_t n = 1;
|
||||||
#if defined(HAS_GETRANDOM)
|
#if defined(HAS_GETRANDOM)
|
||||||
n = getrandom(buf, sizeof(buf), 0);
|
n = getrandom(buf, sizeof(buf), 0);
|
||||||
|
if (n == -1 && errno == ENOSYS)
|
||||||
|
n = 1;
|
||||||
#endif
|
#endif
|
||||||
return (int)(n <= 0);
|
return (int)(n <= 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue