xbps_pkgdb_update: if pkgdb cannot be internalized, create it to simplify code.

This commit is contained in:
Juan RP
2012-11-11 10:03:14 +01:00
parent df0d5d7330
commit f81d8ac1f0
2 changed files with 15 additions and 40 deletions

View File

@ -106,9 +106,12 @@ xbps_pkgdb_update(struct xbps_handle *xhp, bool flush)
cached_rv = 0;
}
/* update copy in memory */
if ((xhp->pkgdb = prop_array_internalize_from_zfile(plist)) == NULL)
cached_rv = rv = errno;
if ((xhp->pkgdb = prop_array_internalize_from_zfile(plist)) == NULL) {
if (errno == ENOENT)
xhp->pkgdb = prop_array_create();
cached_rv = rv = errno;
}
free(plist);
return rv;