xbps_configure_pkg: fail gracefully if metadata cannot be read.

This commit is contained in:
Juan RP 2013-03-05 17:20:29 +01:00
parent a81316a248
commit 301dfe0043

View File

@ -116,10 +116,21 @@ xbps_configure_pkg(struct xbps_handle *xhp,
/* internalize pkg dictionary from metadir */
pkgname = xbps_pkg_name(pkgver);
assert(pkgname);
if (pkgname == NULL) /* assume pkgname */
pkgname = strdup(pkgver);
plist = xbps_xasprintf("%s/.%s.plist", xhp->metadir, pkgname);
free(pkgname);
pkgmetad = prop_dictionary_internalize_from_file(plist);
if (pkgmetad == NULL) {
xbps_set_cb_state(xhp, XBPS_STATE_CONFIGURE_FAIL,
errno, pkgver,
"%s: [configure] cannot read metadata plist: %s",
pkgver, strerror(rv));
return errno;
}
free(plist);
assert(pkgmetad);