commit: 9ffee655057ba300f4a8fb5bfdb91a42baad9c74
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 19 20:26:22 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Nov 19 20:26:22 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=9ffee655
main: fix read_portage_profile to traverse ALL parents
Due to multiple thinkos and fails we never searched beyond the first
profile listed in the parent file. Shame!
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
main.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/main.c b/main.c
index f8ba7af..e236934 100644
--- a/main.c
+++ b/main.c
@@ -570,9 +570,12 @@ read_portage_profile(const char *configroot, const char
*profile, env_vars vars[
size_t configroot_len, profile_len, sub_len;
char *profile_file, *sub_file;
char *s;
+ char *buf = NULL;
+ size_t buf_len = 0;
+ char *saveptr;
- static char *buf;
- static size_t buf_len;
+ if (getenv("DEBUG"))
+ fprintf(stderr, "profile %s/%s\n", configroot, profile);
/* initialize the base profile path */
configroot_len = strlen(configroot);
@@ -593,13 +596,12 @@ read_portage_profile(const char *configroot, const char
*profile, env_vars vars[
strcpy(sub_file, "parent");
if (eat_file(profile_file, &buf, &buf_len) == 0)
goto done;
- rmspace(buf);
- s = strtok(buf, "\n");
+ s = strtok_r(buf, "\n", &saveptr);
while (s) {
strncpy(sub_file, s, sub_len);
read_portage_profile("", profile_file, vars);
- s = strtok(NULL, "\n");
+ s = strtok_r(NULL, "\n", &saveptr);
}
done: