michal-grzedzicki / rpms / rpm

Forked from rpms/rpm 5 months ago
Clone
Blob Blame History Raw
diff --git a/lib/query.c b/lib/query.c
index 6f2d593a7..8a2623241 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -150,8 +150,8 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
 	if ((qva->qva_flags & QUERY_FOR_LICENSE) && !(fflags & RPMFILE_LICENSE))
 	    continue;
 
-	/* If not querying %ghost, skip ghost files. */
-	if ((qva->qva_fflags & RPMFILE_GHOST) && (fflags & RPMFILE_GHOST))
+	/* Skip on attributes (eg from --noghost) */
+	if (fflags & qva->qva_fflags)
 	    continue;
 
 	if (qva->qva_flags & QUERY_FOR_STATE) {
diff --git a/lib/verify.c b/lib/verify.c
index eb6f2e15e..df17a7b01 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -378,10 +378,11 @@ static const char * stateStr(rpmfileState fstate)
  * @param ts		transaction set
  * @param h		header to verify
  * @param omitMask	bits to disable verify checks
- * @param ghosts	should ghosts be verified?
+ * @param skipAttr	skip files with these attrs (eg %ghost)
  * @return		0 no problems, 1 problems found
  */
-static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask, int ghosts)
+static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask,
+			rpmfileAttrs skipAttrs)
 {
     rpmVerifyAttrs verifyResult = 0;
     int ec = 0;		/* assume no problems */
@@ -398,8 +399,8 @@ static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask, int ghosts)
 	char ac;
 	int rc;
 
-	/* If not verifying %ghost, skip ghost files. */
-	if ((fileAttrs & RPMFILE_GHOST) && !ghosts)
+	/* Skip on attributes (eg from --noghost) */
+	if (skipAttrs & fileAttrs)
 	    continue;
 
 	rc = rpmVerifyFile(ts, fi, &verifyResult, omitMask);
@@ -494,7 +495,6 @@ static int verifyDependencies(rpmts ts, Header h)
 int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
 {
     rpmVerifyAttrs omitMask = ((qva->qva_flags & VERIFY_ATTRS) ^ VERIFY_ATTRS);
-    int ghosts = (qva->qva_fflags & RPMFILE_GHOST);
     int ec = 0;
     int rc;
 
@@ -503,7 +503,7 @@ int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
 	    ec = rc;
     }
     if (qva->qva_flags & VERIFY_FILES) {
-	if ((rc = verifyHeader(ts, h, omitMask, ghosts)) != 0)
+	if ((rc = verifyHeader(ts, h, omitMask, qva->qva_fflags)) != 0)
 	    ec = rc;
     }
     if (qva->qva_flags & VERIFY_SCRIPT) {