chiark / gitweb /
basic/random-util: add new header for getrandom()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 Apr 2017 20:13:27 +0000 (16:13 -0400)
committerSven Eden <yamakuzure@gmx.net>
Tue, 25 Jul 2017 07:46:51 +0000 (09:46 +0200)
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.

src/basic/random-util.c

index ad7b3eedf2c1d5ffb7ca92662bff43e070878872..b216be579d28c0fe2d250b263dfe0f49de2ef5fb 100644 (file)
 #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"