1From 676abde95bab10e1d26e91682772514010143343 Mon Sep 17 00:00:00 2001 2From: Peter Seiderer <ps.report@gmx.net> 3Date: Sun, 21 Mar 2021 17:00:08 +0100 4Subject: [PATCH] Check for sys/auxv.h before using it. 5 6- fixes uclibc-ng compile (does not provide sys/auxv.h header file) 7 8Fixes: 9 10 haveged.c:22:10: fatal error: sys/auxv.h: No such file or directory 11 22 | #include <sys/auxv.h> 12 | ^~~~~~~~~~~~ 13 14[Upstream: https://github.com/jirka-h/haveged/pull/59] 15Signed-off-by: Peter Seiderer <ps.report@gmx.net> 16--- 17 configure.ac | 1 + 18 src/haveged.c | 4 ++++ 19 2 files changed, 5 insertions(+) 20 21diff --git a/configure.ac b/configure.ac 22index c172a10..a0263f5 100644 23--- a/configure.ac 24+++ b/configure.ac 25@@ -125,6 +125,7 @@ AC_CHECK_HEADERS(stdio.h) 26 AC_CHECK_HEADERS(stdlib.h) 27 AC_CHECK_HEADERS(string.h) 28 AC_CHECK_HEADERS(sys/ioctl.h) 29+AC_CHECK_HEADERS(sys/auxv.h) 30 AC_CHECK_HEADERS(sys/mman.h) 31 AC_CHECK_HEADERS(sys/types.h) 32 AC_CHECK_HEADERS(sys/socket.h) 33diff --git a/src/haveged.c b/src/haveged.c 34index b9cb77b..dad3072 100644 35--- a/src/haveged.c 36+++ b/src/haveged.c 37@@ -19,7 +19,9 @@ 38 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 39 */ 40 #include "config.h" 41+#if defined(HAVE_SYS_AUXV_H) 42 #include <sys/auxv.h> 43+#endif 44 #include <stdlib.h> 45 #include <stdio.h> 46 #include <getopt.h> 47@@ -135,8 +137,10 @@ int main(int argc, char **argv) 48 { 49 volatile char *path = strdup(argv[0]); 50 volatile char *arg0 = argv[0]; 51+#if defined(HAVE_SYS_AUXV_H) 52 if (path[0] != '/') 53 path = (char*)getauxval(AT_EXECFN); 54+#endif 55 static const char* cmds[] = { 56 "b", "buffer", "1", SETTINGR("Buffer size [KW], default: ",COLLECT_BUFSIZE), 57 "d", "data", "1", SETTINGR("Data cache size [KB], with fallback to: ", GENERIC_DCACHE ), 58-- 592.30.2 60 61