summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2020-12-01 19:11:47 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-03 22:53:09 +0000
commit7548e8755e84f751df35894595e1816cd5283c7d (patch)
treec29e77763d939a3da2c35c7c65b33d23c168b318 /meta
parent89c09260ed77aca3f088eba504f69c99d4c4ee5f (diff)
downloadpoky-7548e8755e84f751df35894595e1816cd5283c7d.tar.gz
pseudo: Simplify pseudo_client_ignore_path_chroot()
This also plugs a memory leak in pseudo_client_ignore_path_chroot(). (From OE-Core rev: d8dddd5054a1c4e20a3e32fa9ab31f5859d6fbb6) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/pseudo/files/0002-pseudo_client-Lessen-indentation-of-pseudo_client_ig.patch69
-rw-r--r--meta/recipes-devtools/pseudo/files/0003-pseudo_client-Simplify-pseudo_client_ignore_path_chr.patch50
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_git.bb2
3 files changed, 121 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/0002-pseudo_client-Lessen-indentation-of-pseudo_client_ig.patch b/meta/recipes-devtools/pseudo/files/0002-pseudo_client-Lessen-indentation-of-pseudo_client_ig.patch
new file mode 100644
index 0000000000..e4a5356f5c
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/0002-pseudo_client-Lessen-indentation-of-pseudo_client_ig.patch
@@ -0,0 +1,69 @@
1From 28c760542eecd7c5b35ea88aa2b14d62afbda961 Mon Sep 17 00:00:00 2001
2From: Peter Kjellerstedt <pkj@axis.com>
3Date: Sat, 21 Nov 2020 17:22:38 +0100
4Subject: [PATCH] pseudo_client: Lessen indentation of
5 pseudo_client_ignore_path_chroot()
6
7Change-Id: I739b18efb7a95ce2d2d907d0faf7df539ab9af1c
8---
9 pseudo_client.c | 45 +++++++++++++++++++++++++--------------------
10 1 file changed, 25 insertions(+), 20 deletions(-)
11
12diff --git a/pseudo_client.c b/pseudo_client.c
13index 116d926..a8bc3dc 100644
14--- a/pseudo_client.c
15+++ b/pseudo_client.c
16@@ -1527,28 +1527,33 @@ int pseudo_client_ignore_fd(int fd) {
17
18 int pseudo_client_ignore_path_chroot(const char *path, int ignore_chroot) {
19 char *env;
20- if (path) {
21- if (ignore_chroot && pseudo_chroot && strncmp(path, pseudo_chroot, pseudo_chroot_len) == 0)
22- return 0;
23- env = pseudo_get_value("PSEUDO_IGNORE_PATHS");
24- if (env) {
25- char *p = env;
26- while (*p) {
27- char *next = strchr(p, ',');
28- if (!next)
29- next = strchr(p, '\0');
30- if ((next - p) && !strncmp(path, p, next - p)) {
31- pseudo_debug(PDBGF_PATH | PDBGF_VERBOSE, "ignoring path: '%s'\n", path);
32- return 1;
33- }
34- if (next && *next != '\0')
35- p = next+1;
36- else
37- break;
38- }
39- free(env);
40+
41+ if (!path)
42+ return 0;
43+
44+ if (ignore_chroot && pseudo_chroot && strncmp(path, pseudo_chroot, pseudo_chroot_len) == 0)
45+ return 0;
46+
47+ env = pseudo_get_value("PSEUDO_IGNORE_PATHS");
48+ if (!env)
49+ return 0;
50+
51+ char *p = env;
52+ while (*p) {
53+ char *next = strchr(p, ',');
54+ if (!next)
55+ next = strchr(p, '\0');
56+ if ((next - p) && !strncmp(path, p, next - p)) {
57+ pseudo_debug(PDBGF_PATH | PDBGF_VERBOSE, "ignoring path: '%s'\n", path);
58+ return 1;
59 }
60+ if (next && *next != '\0')
61+ p = next+1;
62+ else
63+ break;
64 }
65+ free(env);
66+
67 return 0;
68 }
69
diff --git a/meta/recipes-devtools/pseudo/files/0003-pseudo_client-Simplify-pseudo_client_ignore_path_chr.patch b/meta/recipes-devtools/pseudo/files/0003-pseudo_client-Simplify-pseudo_client_ignore_path_chr.patch
new file mode 100644
index 0000000000..a657a27f28
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/0003-pseudo_client-Simplify-pseudo_client_ignore_path_chr.patch
@@ -0,0 +1,50 @@
1From a1d61d68777373a50ae23b9dd83b428abe2f748d Mon Sep 17 00:00:00 2001
2From: Peter Kjellerstedt <pkj@axis.com>
3Date: Sat, 21 Nov 2020 17:30:33 +0100
4Subject: [PATCH] pseudo_client: Simplify pseudo_client_ignore_path_chroot()
5
6This also plugs a memory leak by making sure env is freed.
7
8Change-Id: Ia8635fd2c6b1e85919e4743713a85e0b52c28fac
9---
10 pseudo_client.c | 21 ++++++++++-----------
11 1 file changed, 10 insertions(+), 11 deletions(-)
12
13diff --git a/pseudo_client.c b/pseudo_client.c
14index a8bc3dc..7dc0345 100644
15--- a/pseudo_client.c
16+++ b/pseudo_client.c
17@@ -1538,23 +1538,22 @@ int pseudo_client_ignore_path_chroot(const char *path, int ignore_chroot) {
18 if (!env)
19 return 0;
20
21+ int ret = 0;
22 char *p = env;
23- while (*p) {
24+ while (p) {
25 char *next = strchr(p, ',');
26- if (!next)
27- next = strchr(p, '\0');
28- if ((next - p) && !strncmp(path, p, next - p)) {
29- pseudo_debug(PDBGF_PATH | PDBGF_VERBOSE, "ignoring path: '%s'\n", path);
30- return 1;
31- }
32- if (next && *next != '\0')
33- p = next+1;
34- else
35+ if (next)
36+ *next++ = '\0';
37+ if (*p && !strncmp(path, p, strlen(p))) {
38+ pseudo_debug(PDBGF_PATH | PDBGF_VERBOSE, "ignoring path: '%s'\n", path);
39+ ret = 1;
40 break;
41+ }
42+ p = next;
43 }
44 free(env);
45
46- return 0;
47+ return ret;
48 }
49
50 int pseudo_client_ignore_path(const char *path) {
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index 2e13fec540..50933c4bc1 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -4,6 +4,8 @@ SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \
4 file://0001-configure-Prune-PIE-flags.patch \ 4 file://0001-configure-Prune-PIE-flags.patch \
5 file://fallback-passwd \ 5 file://fallback-passwd \
6 file://fallback-group \ 6 file://fallback-group \
7 file://0002-pseudo_client-Lessen-indentation-of-pseudo_client_ig.patch \
8 file://0003-pseudo_client-Simplify-pseudo_client_ignore_path_chr.patch \
7 " 9 "
8 10
9SRCREV = "cca0d7f15b7197095cd587420d31b187620c3093" 11SRCREV = "cca0d7f15b7197095cd587420d31b187620c3093"