From a61193c7236f5b240585c4f8eef6f452f1d9a7ee Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 26 Jun 2022 19:16:00 +0000 Subject: [PATCH] pkg: fix sysroot_dir logic for github 213 --- libpkgconf/pkg.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index 748f011..834aaa5 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -414,15 +414,12 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE * pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pc_filedir_value, true); free(pc_filedir_value); - /* If pc_filedir is outside of sysroot_dir, clear pc_filedir + /* If pc_filedir is outside of sysroot_dir, override sysroot_dir for this + * package. * See https://github.com/pkgconf/pkgconf/issues/213 */ if (client->sysroot_dir && strncmp(pkg->pc_filedir, client->sysroot_dir, strlen(client->sysroot_dir))) - { - free(client->sysroot_dir); - client->sysroot_dir = NULL; - pkgconf_client_set_sysroot_dir(client, NULL); - } + pkgconf_tuple_add(client, &pkg->vars, "pc_sysrootdir", "", false); /* make module id */ if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL)