summaryrefslogtreecommitdiffstats
path: root/src/basic/random-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-19 22:13:27 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-21 18:05:55 +0200
commit5224c2c7068ea538d2523ad033172450ccac147d (patch)
tree5e58e871bbc885c1ac21c05cd1453478612e27a3 /src/basic/random-util.c
parentlibshared: fix compilation without libblkid (diff)
downloadsystemd-5224c2c7068ea538d2523ad033172450ccac147d.tar.xz
systemd-5224c2c7068ea538d2523ad033172450ccac147d.zip
basic/random-util: add new header for getrandom()
There's some confusion: older man pages specify that linux/random.h contains getrandom, but newer glibc has it in sys/random.h. Detect if the newer header is available and include it. We still need the older header for the flags.
Diffstat (limited to 'src/basic/random-util.c')
-rw-r--r--src/basic/random-util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/basic/random-util.c b/src/basic/random-util.c
index ad7b3eedf2..b216be579d 100644
--- a/src/basic/random-util.c
+++ b/src/basic/random-util.c
@@ -27,7 +27,13 @@
#include <stdint.h>
#ifdef HAVE_SYS_AUXV_H
-#include <sys/auxv.h>
+# include <sys/auxv.h>
+#endif
+
+#ifdef USE_SYS_RANDOM_H
+# include <sys/random.h>
+#else
+# include <linux/random.h>
#endif
#include "fd-util.h"