cli: ensure the client and cross-personality are cleaned up in all cases

master
Ariadne Conill 2021-08-17 14:54:36 -06:00
parent f411e7e55b
commit 41bff10998
1 changed files with 46 additions and 18 deletions

View File

@ -950,8 +950,8 @@ main(int argc, char *argv[])
#endif #endif
case '?': case '?':
case ':': case ':':
return EXIT_FAILURE; ret = EXIT_FAILURE;
break; goto out;
default: default:
break; break;
} }
@ -1001,19 +1001,25 @@ main(int argc, char *argv[])
if ((want_flags & PKG_ABOUT) == PKG_ABOUT) if ((want_flags & PKG_ABOUT) == PKG_ABOUT)
{ {
about(); about();
return EXIT_SUCCESS;
ret = EXIT_SUCCESS;
goto out;
} }
if ((want_flags & PKG_VERSION) == PKG_VERSION) if ((want_flags & PKG_VERSION) == PKG_VERSION)
{ {
version(); version();
return EXIT_SUCCESS;
ret = EXIT_SUCCESS;
goto out;
} }
if ((want_flags & PKG_HELP) == PKG_HELP) if ((want_flags & PKG_HELP) == PKG_HELP)
{ {
usage(); usage();
return EXIT_SUCCESS;
ret = EXIT_SUCCESS;
goto out;
} }
if (getenv("PKG_CONFIG_FDO_SYSROOT_RULES")) if (getenv("PKG_CONFIG_FDO_SYSROOT_RULES"))
@ -1128,21 +1134,25 @@ main(int argc, char *argv[])
if (required_pkgconfig_version != NULL) if (required_pkgconfig_version != NULL)
{ {
if (pkgconf_compare_version(PACKAGE_VERSION, required_pkgconfig_version) >= 0) if (pkgconf_compare_version(PACKAGE_VERSION, required_pkgconfig_version) >= 0)
return EXIT_SUCCESS; ret = EXIT_SUCCESS;
else
ret = EXIT_FAILURE;
return EXIT_FAILURE; goto out;
} }
if ((want_flags & PKG_LIST) == PKG_LIST) if ((want_flags & PKG_LIST) == PKG_LIST)
{ {
pkgconf_scan_all(&pkg_client, NULL, print_list_entry); pkgconf_scan_all(&pkg_client, NULL, print_list_entry);
return EXIT_SUCCESS; ret = EXIT_SUCCESS;
goto out;
} }
if ((want_flags & PKG_LIST_PACKAGE_NAMES) == PKG_LIST_PACKAGE_NAMES) if ((want_flags & PKG_LIST_PACKAGE_NAMES) == PKG_LIST_PACKAGE_NAMES)
{ {
pkgconf_scan_all(&pkg_client, NULL, print_package_entry); pkgconf_scan_all(&pkg_client, NULL, print_package_entry);
return EXIT_SUCCESS; ret = EXIT_SUCCESS;
goto out;
} }
if (logfile_arg == NULL) if (logfile_arg == NULL)
@ -1175,14 +1185,20 @@ main(int argc, char *argv[])
{ {
if (want_flags & PKG_PRINT_ERRORS) if (want_flags & PKG_PRINT_ERRORS)
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package); pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
return EXIT_FAILURE;
ret = EXIT_FAILURE;
goto out;
} }
if (pkgconf_compare_version(pkg->version, required_module_version) >= 0) if (pkgconf_compare_version(pkg->version, required_module_version) >= 0)
return EXIT_SUCCESS; {
ret = EXIT_SUCCESS;
goto out;
}
} }
return EXIT_FAILURE; ret = EXIT_FAILURE;
goto out;
} }
else if (required_exact_module_version != NULL) else if (required_exact_module_version != NULL)
{ {
@ -1205,14 +1221,20 @@ main(int argc, char *argv[])
{ {
if (want_flags & PKG_PRINT_ERRORS) if (want_flags & PKG_PRINT_ERRORS)
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package); pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
return EXIT_FAILURE;
ret = EXIT_FAILURE;
goto out;
} }
if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0) if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0)
return EXIT_SUCCESS; {
ret = EXIT_SUCCESS;
goto out;
}
} }
return EXIT_FAILURE; ret = EXIT_FAILURE;
goto out;
} }
else if (required_max_module_version != NULL) else if (required_max_module_version != NULL)
{ {
@ -1235,14 +1257,20 @@ main(int argc, char *argv[])
{ {
if (want_flags & PKG_PRINT_ERRORS) if (want_flags & PKG_PRINT_ERRORS)
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package); pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
return EXIT_FAILURE;
ret = EXIT_FAILURE;
goto out;
} }
if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0) if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0)
return EXIT_SUCCESS; {
ret = EXIT_SUCCESS;
goto out;
}
} }
return EXIT_FAILURE; ret = EXIT_FAILURE;
goto out;
} }
while (1) while (1)