From f2a77f5e0e78d56ea338796f224c11db06606472 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 22 Dec 2008 00:37:42 +0100 Subject: [PATCH] xbps-pkgdb: fix crash if db file unexistent in 'list' target. --HG-- extra : convert_revision : a42e5a7eda63a0d121dd7f15683220c84d58b620 --- bin/xbps-pkgdb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/xbps-pkgdb.c b/bin/xbps-pkgdb.c index 435a567fb5..0d61482dab 100644 --- a/bin/xbps-pkgdb.c +++ b/bin/xbps-pkgdb.c @@ -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);