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