From 3b702f33aadf29cfdd18bbbdcfc6b63dc068f87c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 27 Dec 2008 08:43:13 +0100 Subject: [PATCH] xbps-pkgdb: check that plist dict is there in version target. --HG-- extra : convert_revision : 926363d195d0e4ce4fcd2e715823f43fd839561c --- bin/xbps-pkgdb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/xbps-pkgdb.c b/bin/xbps-pkgdb.c index 8838091e402..bb4297f5a0d 100644 --- a/bin/xbps-pkgdb.c +++ b/bin/xbps-pkgdb.c @@ -130,13 +130,18 @@ main(int argc, char **argv) if (argc != 3) usage(); - pkgdict = xbps_find_pkg_in_dict( - prop_dictionary_internalize_from_file(dbfile), argv[2]); + dbdict = prop_dictionary_internalize_from_file(dbfile); + if (dbdict == NULL) + exit(1); + + pkgdict = xbps_find_pkg_in_dict(dbdict, argv[2]); if (pkgdict == NULL) exit(1); + if (!prop_dictionary_get_cstring_nocopy(pkgdict, "version", &version)) exit(1); + printf("%s\n", version); } else if (strcasecmp(argv[1], "sanitize-plist") == 0) {