aboutsummaryrefslogtreecommitdiff
path: root/external/unbound/compat/getentropy_linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'external/unbound/compat/getentropy_linux.c')
-rw-r--r--external/unbound/compat/getentropy_linux.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/external/unbound/compat/getentropy_linux.c b/external/unbound/compat/getentropy_linux.c
index b8d4a2bd0..cae18e03b 100644
--- a/external/unbound/compat/getentropy_linux.c
+++ b/external/unbound/compat/getentropy_linux.c
@@ -66,6 +66,9 @@
#include <sys/auxv.h>
#endif
#include <sys/vfs.h>
+#ifndef MAP_ANON
+#define MAP_ANON MAP_ANONYMOUS
+#endif
#define REPEAT 5
#define min(a, b) (((a) < (b)) ? (a) : (b))
@@ -100,7 +103,7 @@ int getentropy(void *buf, size_t len);
extern int main(int, char *argv[]);
#endif
static int gotdata(char *buf, size_t len);
-#ifdef SYS_getrandom
+#if defined(SYS_getrandom) && defined(__NR_getrandom)
static int getentropy_getrandom(void *buf, size_t len);
#endif
static int getentropy_urandom(void *buf, size_t len);
@@ -119,7 +122,7 @@ getentropy(void *buf, size_t len)
return -1;
}
-#ifdef SYS_getrandom
+#if defined(SYS_getrandom) && defined(__NR_getrandom)
/*
* Try descriptor-less getrandom()
*/
@@ -215,7 +218,7 @@ gotdata(char *buf, size_t len)
return 0;
}
-#ifdef SYS_getrandom
+#if defined(SYS_getrandom) && defined(__NR_getrandom)
static int
getentropy_getrandom(void *buf, size_t len)
{