chantra / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
0b2921
From ce11f04ed529cd84de8981b82c1185c0a30dfdcf Mon Sep 17 00:00:00 2001
0b2921
From: Pavlina Moravcova Varekova <pmoravco@redhat.com>
0b2921
Date: Thu, 14 Mar 2019 13:23:13 +0100
0b2921
Subject: [PATCH] Correct rpm -ql exit value when optional -p is omitted
0b2921
 (RhBug:1680610)
0b2921
0b2921
---
0b2921
 lib/query.c | 6 ++++--
0b2921
 1 file changed, 4 insertions(+), 2 deletions(-)
0b2921
0b2921
diff --git a/lib/query.c b/lib/query.c
0b2921
index e47189ed0..e5408e211 100644
0b2921
--- a/lib/query.c
0b2921
+++ b/lib/query.c
0b2921
@@ -568,16 +568,18 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
0b2921
 	break;
0b2921
     default:
0b2921
 	for (ARGV_const_t arg = argv; arg && *arg; arg++) {
0b2921
+	    int ecLocal;
0b2921
 	    rpmdbMatchIterator mi = initQueryIterator(qva, ts, *arg);
0b2921
-	    ec += rpmcliShowMatches(qva, ts, mi);
0b2921
+	    ecLocal = rpmcliShowMatches(qva, ts, mi);
0b2921
 	    if (mi == NULL && qva->qva_source == RPMQV_PACKAGE) {
0b2921
 		size_t l = strlen(*arg);
0b2921
 		if (l > 4 && !strcmp(*arg + l - 4, ".rpm")) {
0b2921
 		    rpmgi gi = rpmgiNew(ts, giFlags, argv);
0b2921
-		    ec += rpmgiShowMatches(qva, ts, gi);
0b2921
+		    ecLocal = rpmgiShowMatches(qva, ts, gi);
0b2921
 		    rpmgiFree(gi);
0b2921
 		}
0b2921
 	    }
0b2921
+	    ec += ecLocal;
0b2921
 	    rpmdbFreeIterator(mi);
0b2921
 	}
0b2921
 	break;
0b2921
-- 
0b2921
2.17.2
0b2921