From 11164376f787c358a913a0ca0dc462c84d304c8c Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 26 Jun 2022 18:34:22 +0000 Subject: [PATCH] main: handle --personality load failure --- cli/main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cli/main.c b/cli/main.c index aa2ae78..4b63fa9 100644 --- a/cli/main.c +++ b/cli/main.c @@ -792,7 +792,7 @@ main(int argc, char *argv[]) char *logfile_arg = NULL; char *want_env_prefix = NULL; unsigned int want_client_flags = PKGCONF_PKG_PKGF_NONE; - pkgconf_cross_personality_t *personality; + pkgconf_cross_personality_t *personality = NULL; bool opened_error_msgout = false; want_flags = 0; @@ -885,12 +885,6 @@ main(int argc, char *argv[]) } #endif -#ifndef PKGCONF_LITE - personality = deduce_personality(argv); -#else - personality = pkgconf_cross_personality_default(); -#endif - while ((ret = pkg_getopt_long_only(argc, argv, "", options, NULL)) != -1) { switch (ret) @@ -948,6 +942,14 @@ main(int argc, char *argv[]) } } + if (personality == NULL) { +#ifndef PKGCONF_LITE + personality = deduce_personality(argv); +#else + personality = pkgconf_cross_personality_default(); +#endif + } + pkgconf_path_copy_list(&personality->dir_list, &dir_list); pkgconf_path_free(&dir_list);