1From 135414a7f543e4d40ad0a7cbd51885e159a6e0f4 Mon Sep 17 00:00:00 2001
2From: Paul Eggert <eggert@cs.ucla.edu>
3Date: Tue, 30 Nov 2021 17:50:01 -0800
4Subject: sys_random: port better to uClibc < 1.0.35
5
6Problem reported by Fabrice Fontaine in:
7https://lists.gnu.org/r/bug-gnulib/2021-11/msg00043.html
8* lib/sys_random.in.h [HAVE_SYS_RANDOM_H && !__GLIBC__ && __UCLIBC__]:
9Include <stddef.h>, in case this file is included before
10__UCLIBC__ is defined.
11
12[Retrieved (and backported to remove ChangeLog update) from:
13https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=135414a7f543e4d40ad0a7cbd51885e159a6e0f4]
14Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
15---
16 ChangeLog           | 9 +++++++++
17 lib/sys_random.in.h | 6 ++++--
18 2 files changed, 13 insertions(+), 2 deletions(-)
19
20diff --git a/lib/sys_random.in.h b/lib/sys_random.in.h
21index 1abd6c544..8b4b934a1 100644
22--- a/lib/sys_random.in.h
23+++ b/lib/sys_random.in.h
24@@ -23,8 +23,10 @@
25
26 #if @HAVE_SYS_RANDOM_H@
27
28-/* On uClibc, <sys/random.h> assumes prior inclusion of <stddef.h>.  */
29-# if defined __UCLIBC__
30+/* On uClibc < 1.0.35, <sys/random.h> assumes prior inclusion of <stddef.h>.
31+   Do not use __UCLIBC__ here, as it might not be defined yet.
32+   But avoid namespace pollution on glibc systems.  */
33+# ifndef __GLIBC__
34 #  include <stddef.h>
35 # endif
36 /* On Mac OS X 10.5, <sys/random.h> assumes prior inclusion of <sys/types.h>.
37--
38cgit v1.2.1
39
40