From c0ab315e71c46e36de038dde4a32ebe6eba04c41 Mon Sep 17 00:00:00 2001 From: Alexey Tourbin Date: Wed, 21 Apr 2010 11:10:15 +0400 Subject: [PATCH] rpmdb.c (dbiOpen): fix dbix condition In the loop, dbix is always initialized to 0, so checking (dbix < 0) is uselss. Insetead, we sould check (dbix >= dbiTagsMax). --- lib/rpmdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rpmdb.c b/lib/rpmdb.c index d299e9c..43f86e9 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -122,7 +122,7 @@ static inline pbm_set * PBM_REALLOC(pbm_set ** sp, int * odp, int nd) */ static dbiIndex rpmdbOpenIndex(rpmdb db, rpmTag rpmtag, unsigned int flags) { - int dbix = -1; + int dbix; dbiIndex dbi = NULL; int _dbapi, _dbapi_rebuild, _dbapi_wanted; int rc = 0; @@ -134,7 +134,7 @@ static dbiIndex rpmdbOpenIndex(rpmdb db, rpmTag rpmtag, unsigned int flags) if (rpmtag == dbiTags[dbix]) break; } - if (dbix < 0) + if (dbix >= dbiTagsMax) return NULL; /* Is this index already open ? */ -- 2.7.4