1From a0594387565e1e6b4a8a8ba04ad13b135cc1f0b5 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Thu, 1 Apr 2021 07:49:46 +0200
4Subject: [PATCH] lib/getrandom.c: fix build with uclibc < 1.0.35
5
6Fix the following build failure with uclibc < 1.0.35 which is raised
7since the addition of getrandom module in
8https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=682cc4e678aceff32dea2a84b6e5147bdf5a20a7:
9
10In file included from ./sys/random.h:40,
11                 from getrandom.c:22:
12/tmp/instance-0/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/sys/random.h:27:35: error: unknown type name 'size_t'
13   27 | extern int getrandom(void *__buf, size_t count, unsigned int flags)
14      |                                   ^~~~~~
15/tmp/instance-0/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/sys/random.h:8:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
16    7 | #include <features.h>
17  +++ |+#include <stddef.h>
18    8 |
19
20This patch is not upstreamable as it is only a workaround for
21uclibc < 1.0.35, upstream uclibc has been patched with
22https://github.com/wbx-github/uclibc-ng/commit/00972c02c2b6e0a95d5def4a71bdfb188e091782
23
24Fixes:
25 - http://autobuild.buildroot.org/results/30105094e39374ec6d4e47e2fb5e99696f7f7981
26
27Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
28---
29 jitter/gnulib-local/getrandom.c | 1 +
30 gl/getrandom.c                  | 1 +
31 gl-libpoke/getrandom.c          | 1 +
32 3 files changed, 3 insertions(+)
33
34diff --git a/jitter/gnulib-local/getrandom.c b/jitter/gnulib-local/getrandom.c
35index 41212fb32..0ad3f9648 100644
36--- a/jitter/gnulib-local/getrandom.c
37+++ b/jitter/gnulib-local/getrandom.c
38@@ -19,6 +19,7 @@
39
40 #include <config.h>
41
42+#include <stddef.h>
43 #include <sys/random.h>
44
45 #include <errno.h>
46diff --git a/gl/getrandom.c b/gl/getrandom.c
47index 41212fb32..0ad3f9648 100644
48--- a/gl/getrandom.c
49+++ b/gl/getrandom.c
50@@ -19,6 +19,7 @@
51
52 #include <config.h>
53
54+#include <stddef.h>
55 #include <sys/random.h>
56
57 #include <errno.h>
58diff --git a/gl-libpoke/getrandom.c b/gl-libpoke/getrandom.c
59index 41212fb32..0ad3f9648 100644
60--- a/gl-libpoke/getrandom.c
61+++ b/gl-libpoke/getrandom.c
62@@ -19,6 +19,7 @@
63
64 #include <config.h>
65
66+#include <stddef.h>
67 #include <sys/random.h>
68
69 #include <errno.h>
70--
712.30.2
72
73