mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
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>
This commit is contained in:
parent
3009b22aec
commit
06d9a8eff0
@ -81,7 +81,7 @@ AM_CONDITIONAL(HAVE_RUBY, test x$with_ruby = xyes)
|
|||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(unistd.h stdint.h syslog.h)
|
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
|
AM_PROG_CC_C_O
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
|
@ -43,6 +43,17 @@
|
|||||||
#endif
|
#endif
|
||||||
#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 {
|
struct ignored_suffix_t {
|
||||||
const char * text;
|
const char * text;
|
||||||
int len;
|
int len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user