From 2c644c65870cb6c06fb621e6e72226113e76e273 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 26 Feb 2011 11:08:58 +0100 Subject: [PATCH] Treat pkgs with NULL or empty requiredby arrays as orphans. --- lib/package_orphans.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/package_orphans.c b/lib/package_orphans.c index ee5d083a..98a2df79 100644 --- a/lib/package_orphans.c +++ b/lib/package_orphans.c @@ -97,13 +97,10 @@ find_orphan_pkg(prop_object_t obj, void *arg, bool *loop_done) return 0; reqby = prop_dictionary_get(obj, "requiredby"); - if (prop_object_type(reqby) != PROP_TYPE_ARRAY) - return EINVAL; - /* - * Add packages with empty "requiredby" arrays. - */ - cnt = prop_array_count(reqby); - if (cnt == 0) { + if (reqby == NULL || ((cnt = prop_array_count(reqby)) == 0)) { + /* + * Add packages with empty or missing "requiredby" arrays. + */ prop_array_add(od->array, obj); return 0; }