summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seiderer <ps.report@gmx.net>2021-03-21 17:00:08 +0100
committerPeter Seiderer <ps.report@gmx.net>2021-03-21 22:06:13 +0100
commit9c33be85e885cf4bfcb236831475ed315ae5646a (patch)
treef97c3927676dfb681c75b692dbb14c3a2e90b46a
parentAdded dracut conf file which can be placed in /etc/dracut.conf.d/haveged.conf (diff)
downloadhaveged-9c33be85e885cf4bfcb236831475ed315ae5646a.tar.xz
haveged-9c33be85e885cf4bfcb236831475ed315ae5646a.zip
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> | ^~~~~~~~~~~~ Signed-off-by: Peter Seiderer <ps.report@gmx.net>
-rw-r--r--configure.ac1
-rw-r--r--src/haveged.c4
2 files changed, 5 insertions, 0 deletions
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 ),