main: handle --personality load failure

master
Ariadne Conill 2022-06-26 18:34:22 +00:00
parent ab352222a2
commit 11164376f7
1 changed files with 9 additions and 7 deletions

View File

@ -792,7 +792,7 @@ main(int argc, char *argv[])
char *logfile_arg = NULL; char *logfile_arg = NULL;
char *want_env_prefix = NULL; char *want_env_prefix = NULL;
unsigned int want_client_flags = PKGCONF_PKG_PKGF_NONE; 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; bool opened_error_msgout = false;
want_flags = 0; want_flags = 0;
@ -885,12 +885,6 @@ main(int argc, char *argv[])
} }
#endif #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) while ((ret = pkg_getopt_long_only(argc, argv, "", options, NULL)) != -1)
{ {
switch (ret) 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_copy_list(&personality->dir_list, &dir_list);
pkgconf_path_free(&dir_list); pkgconf_path_free(&dir_list);