aboutsummaryrefslogtreecommitdiffstats
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
commit99566991931164b9a853c76db977d73ada6f630f (patch)
treef36e90d4f5289929c6c8b2473ff85735e29c4071
parent7fc0bff0d7f000e6610e5546277e832c5f9f47e3 (diff)
downloadprosody-99566991931164b9a853c76db977d73ada6f630f.tar.gz
prosody-99566991931164b9a853c76db977d73ada6f630f.zip
util.crand: Only include getrandom shiv with glibc older than 2.25
-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>