diff options
author | Kim Alvefur <zash@zash.se> | 2017-03-02 00:17:34 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-03-02 00:17:34 +0100 |
commit | 956c50882b749f8b3cc007aaec8c0a5c2c6725ee (patch) | |
tree | f36e90d4f5289929c6c8b2473ff85735e29c4071 /util-src/crand.c | |
parent | 7dba99875fa4a3539cc7778efa7486bdcefea898 (diff) | |
download | prosody-956c50882b749f8b3cc007aaec8c0a5c2c6725ee.tar.gz prosody-956c50882b749f8b3cc007aaec8c0a5c2c6725ee.zip |
util.crand: Only include getrandom shiv with glibc older than 2.25
Diffstat (limited to 'util-src/crand.c')
-rw-r--r-- | util-src/crand.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/util-src/crand.c b/util-src/crand.c index 353b153c..ef9da4d2 100644 --- a/util-src/crand.c +++ b/util-src/crand.c @@ -28,17 +28,22 @@ #include <errno.h> #if defined(WITH_GETRANDOM) + +#if ! __GLIBC_PREREQ(2,25) #include <unistd.h> #include <sys/syscall.h> -#include <linux/random.h> #ifndef SYS_getrandom #error getrandom() requires Linux 3.17 or later #endif +/* This wasn't present before glibc 2.25 */ int getrandom(void *buf, size_t buflen, unsigned int flags) { return syscall(SYS_getrandom, buf, buflen, flags); } +#else +#include <sys/random.h> +#endif #elif defined(WITH_ARC4RANDOM) #include <stdlib.h> |