diff --git a/include/xbps_api.h b/include/xbps_api.h index 4ff2425e..9064b5c0 100644 --- a/include/xbps_api.h +++ b/include/xbps_api.h @@ -56,7 +56,7 @@ */ #define XBPS_PKGINDEX_VERSION "1.5" -#define XBPS_API_VERSION "20120605-2" +#define XBPS_API_VERSION "20120605-3" #define XBPS_VERSION "0.16" /** diff --git a/lib/transaction_ops.c b/lib/transaction_ops.c index b2f67c9d..155a3fa0 100644 --- a/lib/transaction_ops.c +++ b/lib/transaction_ops.c @@ -239,8 +239,9 @@ xbps_transaction_update_pkg(const char *pkgname) int xbps_transaction_install_pkg(const char *pkg, bool reinstall) { - prop_dictionary_t pkgd; + prop_dictionary_t pkgd = NULL; pkg_state_t state; + char *pkgname; bool bypattern, best, exact; int rv; @@ -248,7 +249,7 @@ xbps_transaction_install_pkg(const char *pkg, bool reinstall) bypattern = true; best = false; exact = false; - } else if (xbps_pkg_name(pkg)) { + } else if ((pkgname = xbps_pkg_name(pkg)) != NULL) { exact = true; bypattern = false; best = false; @@ -258,7 +259,13 @@ xbps_transaction_install_pkg(const char *pkg, bool reinstall) best = true; } - if ((pkgd = xbps_pkgdb_get_pkgd(pkg, bypattern)) != NULL) { + if (exact) { + pkgd = xbps_pkgdb_get_pkgd(pkgname, false); + free(pkgname); + } else + pkgd = xbps_pkgdb_get_pkgd(pkg, bypattern); + + if (pkgd) { if (xbps_pkg_state_dictionary(pkgd, &state) != 0) { prop_object_release(pkgd); return EINVAL;