From: Alexey Tourbin Date: Wed, 21 Apr 2010 07:10:15 +0000 (+0400) Subject: rpmdb.c (dbiOpen): fix dbix condition X-Git-Tag: tznext/4.11.0.1.tizen20130304~1996 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0ab315e71c46e36de038dde4a32ebe6eba04c41;p=tools%2Flibrpm-tizen.git 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). --- 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 ? */