mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-26 08:51:25 +02:00
60 lines
1.9 KiB
Diff
60 lines
1.9 KiB
Diff
From e9b875a4b48d5a41d6c398a44ac6bec216fded5f Mon Sep 17 00:00:00 2001
|
|
From: Steve Beattie <steve.beattie@canonical.com>
|
|
Date: Wed, 18 Apr 2018 12:37:09 -0700
|
|
Subject: [PATCH 01/11] libapparmor: fix reallocarray FTBFS w/older glibc
|
|
|
|
The recently added overlay cache directory support added to libapparmor
|
|
makes use of reallocarray(3) to resize memory allocations; however,
|
|
reallocarray() was only included in glibc 2.26. This commit adds a
|
|
configure check for reallocarray() and if it's not available, provides
|
|
it as a wrapper around realloc(3).
|
|
|
|
PR: https://gitlab.com/apparmor/apparmor/merge_requests/100
|
|
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
|
|
Acked-by: John Johansen <john.johansen@canonical.com>
|
|
|
|
(cherry picked from commit 8e6313761246099429e9bd12ea6db02d7052188b)
|
|
---
|
|
libraries/libapparmor/configure.ac | 2 +-
|
|
libraries/libapparmor/src/private.c | 11 +++++++++++
|
|
2 files changed, 12 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libraries/libapparmor/configure.ac b/libraries/libapparmor/configure.ac
|
|
index 479ba6dd..73d99398 100644
|
|
--- a/libraries/libapparmor/configure.ac
|
|
+++ b/libraries/libapparmor/configure.ac
|
|
@@ -81,7 +81,7 @@ AM_CONDITIONAL(HAVE_RUBY, test x$with_ruby = xyes)
|
|
AC_HEADER_STDC
|
|
AC_CHECK_HEADERS(unistd.h stdint.h syslog.h)
|
|
|
|
-AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv])
|
|
+AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv reallocarray])
|
|
|
|
AM_PROG_CC_C_O
|
|
AC_C_CONST
|
|
diff --git a/libraries/libapparmor/src/private.c b/libraries/libapparmor/src/private.c
|
|
index bece09d1..218f6628 100644
|
|
--- a/libraries/libapparmor/src/private.c
|
|
+++ b/libraries/libapparmor/src/private.c
|
|
@@ -43,6 +43,17 @@
|
|
#endif
|
|
#endif
|
|
|
|
+/**
|
|
+ * Allow libapparmor to build on older glibcs and other libcs that do
|
|
+ * not support reallocarray.
|
|
+ */
|
|
+#ifndef HAVE_REALLOCARRY
|
|
+void *reallocarray(void *ptr, size_t nmemb, size_t size)
|
|
+{
|
|
+ return realloc(ptr, nmemb * size);
|
|
+}
|
|
+#endif
|
|
+
|
|
struct ignored_suffix_t {
|
|
const char * text;
|
|
int len;
|
|
--
|
|
2.17.1
|
|
|