From 1393d9332faa32d042be5c59f58588a792a9800b Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 3 Jun 2009 12:54:54 +0200 Subject: [PATCH] - treat missing vendor as empty string in vendorchange check --- src/policy.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/policy.c b/src/policy.c index 0782592..2148b10 100644 --- a/src/policy.c +++ b/src/policy.c @@ -414,22 +414,25 @@ int policy_illegal_vendorchange(Solver *solv, Solvable *s1, Solvable *s2) { Pool *pool = solv->pool; + Id v1, v2; Id vendormask1, vendormask2; - if (solv && solv->vendorCheckCb) + if (solv->vendorCheckCb) { /* The application is responsible for */ - return solv->vendorCheckCb(solv->pool, s1, s2); + return solv->vendorCheckCb(pool, s1, s2); } - - if (s1->vendor == s2->vendor) + /* treat a missing vendor as empty string */ + v1 = s1->vendor ? s1->vendor : ID_EMPTY; + v2 = s2->vendor ? s2->vendor : ID_EMPTY; + if (v1 == v2) return 0; - vendormask1 = pool_vendor2mask(pool, s1->vendor); + vendormask1 = pool_vendor2mask(pool, v1); if (!vendormask1) - return 0; - vendormask2 = pool_vendor2mask(pool, s2->vendor); + return 1; /* can't match */ + vendormask2 = pool_vendor2mask(pool, v2); if ((vendormask1 & vendormask2) != 0) return 0; - return 1; + return 1; /* no class matches */ } -- 2.7.4