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-24 09:40:29 +0000 |
commit | 22333f01d8b5342cd2a1fbda7d58e414e9a34f2b (patch) | |
tree | 036311d19c2526bde233599756baf230bb12026e /meta/recipes-extended/libuser | |
parent | ea9dc990a98b40358ed60f1efbc7d0c2e4e2ca9e (diff) | |
download | poky-22333f01d8b5342cd2a1fbda7d58e414e9a34f2b.tar.gz |
libuser: Fix build when secure getenv is not there
Fixes build on musl
(From OE-Core rev: a0739c37bef360b0268267284b86adf3cc140051)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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 @@ | |||
1 | From d0537cb7f2dc5877700ad78dfd191515379d4edc Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 7 Jan 2016 02:22:51 +0000 | ||
4 | Subject: [PATCH 1/2] Check for issetugid() | ||
5 | |||
6 | If secure version of getenv is not there then we can use | ||
7 | issetugid() as aid to call getenv() | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | Upstream-Status: Pending | ||
12 | |||
13 | configure.ac | 1 + | ||
14 | lib/config.c | 12 +++++++++++- | ||
15 | 2 files changed, 12 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/configure.ac b/configure.ac | ||
18 | index 1ded1a2..ee19e1f 100644 | ||
19 | --- a/configure.ac | ||
20 | +++ b/configure.ac | ||
21 | @@ -125,6 +125,7 @@ AC_TYPE_OFF_T | ||
22 | AC_TYPE_SIZE_T | ||
23 | |||
24 | AC_CHECK_FUNCS([__secure_getenv secure_getenv]) | ||
25 | +AC_CHECK_FUNCS([issetugid]) | ||
26 | |||
27 | # Modify CFLAGS after all tests are run (some of them could fail because | ||
28 | # of the -Werror). | ||
29 | diff --git a/lib/config.c b/lib/config.c | ||
30 | index 29e7120..30f9daf 100644 | ||
31 | --- a/lib/config.c | ||
32 | +++ b/lib/config.c | ||
33 | @@ -44,8 +44,10 @@ | ||
34 | # define safe_getenv(string) secure_getenv(string) | ||
35 | #elif defined(HAVE___SECURE_GETENV) | ||
36 | # define safe_getenv(string) __secure_getenv(string) | ||
37 | +#elif defined(HAVE_ISSETUGID) | ||
38 | +# define safe_getenv(string) safe_getenv_issetugid(string) | ||
39 | #else | ||
40 | -# error Neither secure_getenv not __secure_getenv are available | ||
41 | +# error None of secure_getenv, __secure_getenv, or issetugid is available | ||
42 | #endif | ||
43 | |||
44 | struct config_config { | ||
45 | @@ -59,6 +61,14 @@ struct config_key { | ||
46 | GList *values; | ||
47 | }; | ||
48 | |||
49 | +static const char* | ||
50 | +safe_getenv_issetugid(const char* name) | ||
51 | +{ | ||
52 | + if (issetugid ()) | ||
53 | + return 0; | ||
54 | + return getenv (name); | ||
55 | +} | ||
56 | + | ||
57 | /* Compare two section names */ | ||
58 | static int | ||
59 | compare_section_names(gconstpointer a, gconstpointer b) | ||
60 | -- | ||
61 | 2.7.0 | ||
62 | |||
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 @@ | |||
1 | From 4b2f81f307ffeac12956e5c16e894e5ebb937ea5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 7 Jan 2016 02:26:00 +0000 | ||
4 | Subject: [PATCH 2/2] remove unused execinfo.h | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | Upstream-Status: Pending | ||
9 | |||
10 | lib/error.c | 1 - | ||
11 | 1 file changed, 1 deletion(-) | ||
12 | |||
13 | diff --git a/lib/error.c b/lib/error.c | ||
14 | index a5ec30a..443e601 100644 | ||
15 | --- a/lib/error.c | ||
16 | +++ b/lib/error.c | ||
17 | @@ -18,7 +18,6 @@ | ||
18 | #include <config.h> | ||
19 | #include <sys/types.h> | ||
20 | #include <errno.h> | ||
21 | -#include <execinfo.h> | ||
22 | #include <libintl.h> | ||
23 | #include <stdarg.h> | ||
24 | #include <stdlib.h> | ||
25 | -- | ||
26 | 2.7.0 | ||
27 | |||
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 \ | |||
12 | SECTION = "base" | 12 | SECTION = "base" |
13 | 13 | ||
14 | SRC_URI = "https://fedorahosted.org/releases/l/i/libuser/libuser-${PV}.tar.xz \ | 14 | SRC_URI = "https://fedorahosted.org/releases/l/i/libuser/libuser-${PV}.tar.xz \ |
15 | " | 15 | file://0001-Check-for-issetugid.patch \ |
16 | file://0002-remove-unused-execinfo.h.patch \ | ||
17 | " | ||
16 | 18 | ||
17 | SRC_URI[md5sum] = "63e5e5c551e99dc5302b40b80bd6d4f2" | 19 | SRC_URI[md5sum] = "63e5e5c551e99dc5302b40b80bd6d4f2" |
18 | SRC_URI[sha256sum] = "a58ff4fabb01a25043b142185a33eeea961109dd60d4b40b6a9df4fa3cace20b" | 20 | SRC_URI[sha256sum] = "a58ff4fabb01a25043b142185a33eeea961109dd60d4b40b6a9df4fa3cace20b" |