Allow libapparmor to build on older systems where secure_getenv() is still named __secure_getenv(). This snippet was taken from the glibc wiki:
https://sourceware.org/glibc/wiki/Tips_and_Tricks/secure_getenv Signed-off-by: Tyler Hicks <[email protected]> --- We need to start using a configuration header file (config.h) for things like this, the recent asprintf() redefine, etc. https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Configuration-Headers.html libraries/libapparmor/configure.ac | 2 +- libraries/libapparmor/src/private.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libraries/libapparmor/configure.ac b/libraries/libapparmor/configure.ac index fe6971c..479ba6d 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) +AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv]) AM_PROG_CC_C_O AC_C_CONST diff --git a/libraries/libapparmor/src/private.c b/libraries/libapparmor/src/private.c index c99a57d..f078f28 100644 --- a/libraries/libapparmor/src/private.c +++ b/libraries/libapparmor/src/private.c @@ -30,6 +30,19 @@ #include "private.h" +/** + * Allow libapparmor to build on older systems where secure_getenv() is still + * named __secure_getenv(). This snippet was taken from the glibc wiki + * (https://sourceware.org/glibc/wiki/Tips_and_Tricks/secure_getenv). + */ +#ifndef HAVE_SECURE_GETENV + #ifdef HAVE___SECURE_GETENV + #define secure_getenv __secure_getenv + #else + #error neither secure_getenv nor __secure_getenv is available + #endif +#endif + struct ignored_suffix_t { const char * text; int len; -- 2.1.4 -- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
