xbps-pkgdb: fix crash if db file unexistent in 'list' target.

--HG--
extra : convert_revision : a42e5a7eda63a0d121dd7f15683220c84d58b620
This commit is contained in:
Juan RP 2008-12-22 00:37:42 +01:00
parent 6fbb8e0316
commit f2a77f5e0e

View File

@ -234,6 +234,12 @@ main(int argc, char **argv)
usage();
dbdict = prop_dictionary_internalize_from_file(dbfile);
if (dbdict == NULL) {
printf("=> ERROR: cannot read database file (%s)\n",
strerror(errno));
exit(EINVAL);
}
if (!xbps_callback_array_iter_in_dict(dbdict,
"packages", xbps_list_pkgs_in_dict, NULL))
exit(EINVAL);