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
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue