richardphibel / rpms / rpm

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