From: jbj Date: Tue, 5 Jan 1999 17:27:04 +0000 (+0000) Subject: Avoid segfault with "rpm --initdb" when no database exists. X-Git-Tag: tznext/4.11.0.1.tizen20130304~9470 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7c985480ab320547dbdb977a0e8682c24710393;p=tools%2Flibrpm-tizen.git Avoid segfault with "rpm --initdb" when no database exists. CVS patchset: 2650 CVS date: 1999/01/05 17:27:04 --- diff --git a/lib/rpmdb.c b/lib/rpmdb.c index 675da45..bdc8a54 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -182,7 +182,7 @@ int openDatabase(char * prefix, char * dbpath, rpmdb *rpmdbp, int mode, /* We used to store the fileindexes as complete paths, rather then plain basenames. Let's see which version we are... */ - if (!dbiGetFirstKey(db.fileIndex, &akey)) { + if (!justcheck && !dbiGetFirstKey(db.fileIndex, &akey)) { if (strchr(akey, '/')) { rpmError(RPMERR_OLDDB, _("old format database is present; " "use --rebuilddb to generate a new format database"));