aboutsummaryrefslogtreecommitdiffstats
path: root/util-src/crand.c
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-03-02 00:17:34 +0100
committerKim Alvefur <zash@zash.se>2017-03-02 00:17:34 +0100
commit956c50882b749f8b3cc007aaec8c0a5c2c6725ee (patch)
treef36e90d4f5289929c6c8b2473ff85735e29c4071 /util-src/crand.c
parent7dba99875fa4a3539cc7778efa7486bdcefea898 (diff)
downloadprosody-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.c7
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>