From 38e959857acdc33d724c4d7254b5844b2f5ce5ee Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 9 Dec 2016 21:08:53 -0600 Subject: [PATCH] libpkgconf: client: initialize sysroot and buildroot dirs to reasonable defaults --- libpkgconf/client.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libpkgconf/client.c b/libpkgconf/client.c index 5fb3ce4..f493bdf 100644 --- a/libpkgconf/client.c +++ b/libpkgconf/client.c @@ -20,6 +20,9 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error { client->error_handler = error_handler; client->auditf = NULL; + + pkgconf_client_set_sysroot_dir(client, NULL); + pkgconf_client_set_buildroot_dir(client, NULL); } pkgconf_client_t * @@ -64,6 +67,8 @@ pkgconf_client_set_sysroot_dir(pkgconf_client_t *client, const char *sysroot_dir free(client->sysroot_dir); client->sysroot_dir = sysroot_dir != NULL ? strdup(sysroot_dir) : NULL; + + pkgconf_tuple_add_global(client, "pc_sysrootdir", client->sysroot_dir != NULL ? client->sysroot_dir : "/"); } const char * @@ -79,4 +84,6 @@ pkgconf_client_set_buildroot_dir(pkgconf_client_t *client, const char *buildroot free(client->buildroot_dir); client->buildroot_dir = buildroot_dir != NULL ? strdup(buildroot_dir) : NULL; + + pkgconf_tuple_add_global(client, "pc_top_builddir", client->buildroot_dir != NULL ? client->buildroot_dir : "$(top_builddir)"); }