diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-01-07 02:31:19 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-22 23:42:50 +0000 |
commit | a0739c37bef360b0268267284b86adf3cc140051 (patch) | |
tree | 65bc53a0e7bb16730bf90e6ec6ecae6b3bf33363 /meta/recipes-extended/libuser | |
parent | 3c54b18797eb26d2045fd506d2b0c8b996a0396c (diff) | |
download | openembedded-core-a0739c37bef360b0268267284b86adf3cc140051.tar.gz openembedded-core-a0739c37bef360b0268267284b86adf3cc140051.tar.bz2 openembedded-core-a0739c37bef360b0268267284b86adf3cc140051.zip |
libuser: Fix build when secure getenv is not there
Fixes build on musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta/recipes-extended/libuser')
3 files changed, 92 insertions, 1 deletions
diff --git a/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch b/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch new file mode 100644 index 0000000000..79756b9a07 --- /dev/null +++ b/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch @@ -0,0 +1,62 @@ +From d0537cb7f2dc5877700ad78dfd191515379d4edc Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 7 Jan 2016 02:22:51 +0000 +Subject: [PATCH 1/2] Check for issetugid() + +If secure version of getenv is not there then we can use +issetugid() as aid to call getenv() + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + configure.ac | 1 + + lib/config.c | 12 +++++++++++- + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 1ded1a2..ee19e1f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -125,6 +125,7 @@ AC_TYPE_OFF_T + AC_TYPE_SIZE_T + + AC_CHECK_FUNCS([__secure_getenv secure_getenv]) ++AC_CHECK_FUNCS([issetugid]) + + # Modify CFLAGS after all tests are run (some of them could fail because + # of the -Werror). +diff --git a/lib/config.c b/lib/config.c +index 29e7120..30f9daf 100644 +--- a/lib/config.c ++++ b/lib/config.c +@@ -44,8 +44,10 @@ + # define safe_getenv(string) secure_getenv(string) + #elif defined(HAVE___SECURE_GETENV) + # define safe_getenv(string) __secure_getenv(string) ++#elif defined(HAVE_ISSETUGID) ++# define safe_getenv(string) safe_getenv_issetugid(string) + #else +-# error Neither secure_getenv not __secure_getenv are available ++# error None of secure_getenv, __secure_getenv, or issetugid is available + #endif + + struct config_config { +@@ -59,6 +61,14 @@ struct config_key { + GList *values; + }; + ++static const char* ++safe_getenv_issetugid(const char* name) ++{ ++ if (issetugid ()) ++ return 0; ++ return getenv (name); ++} ++ + /* Compare two section names */ + static int + compare_section_names(gconstpointer a, gconstpointer b) +-- +2.7.0 + diff --git a/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch b/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch new file mode 100644 index 0000000000..4bc0219f19 --- /dev/null +++ b/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch @@ -0,0 +1,27 @@ +From 4b2f81f307ffeac12956e5c16e894e5ebb937ea5 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 7 Jan 2016 02:26:00 +0000 +Subject: [PATCH 2/2] remove unused execinfo.h + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + lib/error.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/lib/error.c b/lib/error.c +index a5ec30a..443e601 100644 +--- a/lib/error.c ++++ b/lib/error.c +@@ -18,7 +18,6 @@ + #include <config.h> + #include <sys/types.h> + #include <errno.h> +-#include <execinfo.h> + #include <libintl.h> + #include <stdarg.h> + #include <stdlib.h> +-- +2.7.0 + diff --git a/meta/recipes-extended/libuser/libuser_0.62.bb b/meta/recipes-extended/libuser/libuser_0.62.bb index 4caa8a1495..2d5bd353c9 100644 --- a/meta/recipes-extended/libuser/libuser_0.62.bb +++ b/meta/recipes-extended/libuser/libuser_0.62.bb @@ -12,7 +12,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ SECTION = "base" SRC_URI = "https://fedorahosted.org/releases/l/i/libuser/libuser-${PV}.tar.xz \ - " + file://0001-Check-for-issetugid.patch \ + file://0002-remove-unused-execinfo.h.patch \ + " SRC_URI[md5sum] = "63e5e5c551e99dc5302b40b80bd6d4f2" SRC_URI[sha256sum] = "a58ff4fabb01a25043b142185a33eeea961109dd60d4b40b6a9df4fa3cace20b" |