diff options
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 @@ | |||
1 | From 28c760542eecd7c5b35ea88aa2b14d62afbda961 Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Kjellerstedt <pkj@axis.com> | ||
3 | Date: Sat, 21 Nov 2020 17:22:38 +0100 | ||
4 | Subject: [PATCH] pseudo_client: Lessen indentation of | ||
5 | pseudo_client_ignore_path_chroot() | ||
6 | |||
7 | Change-Id: I739b18efb7a95ce2d2d907d0faf7df539ab9af1c | ||
8 | --- | ||
9 | pseudo_client.c | 45 +++++++++++++++++++++++++-------------------- | ||
10 | 1 file changed, 25 insertions(+), 20 deletions(-) | ||
11 | |||
12 | diff --git a/pseudo_client.c b/pseudo_client.c | ||
13 | index 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 @@ | |||
1 | From a1d61d68777373a50ae23b9dd83b428abe2f748d Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Kjellerstedt <pkj@axis.com> | ||
3 | Date: Sat, 21 Nov 2020 17:30:33 +0100 | ||
4 | Subject: [PATCH] pseudo_client: Simplify pseudo_client_ignore_path_chroot() | ||
5 | |||
6 | This also plugs a memory leak by making sure env is freed. | ||
7 | |||
8 | Change-Id: Ia8635fd2c6b1e85919e4743713a85e0b52c28fac | ||
9 | --- | ||
10 | pseudo_client.c | 21 ++++++++++----------- | ||
11 | 1 file changed, 10 insertions(+), 11 deletions(-) | ||
12 | |||
13 | diff --git a/pseudo_client.c b/pseudo_client.c | ||
14 | index 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 | ||
9 | SRCREV = "cca0d7f15b7197095cd587420d31b187620c3093" | 11 | SRCREV = "cca0d7f15b7197095cd587420d31b187620c3093" |