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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-04-21 12:05:55 -04:00
parent d1c536f502
commit 5224c2c706
2 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -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"