Avoid segfault with "rpm --initdb" when no database exists.
authorjbj <devnull@localhost>
Tue, 5 Jan 1999 17:27:04 +0000 (17:27 +0000)
committerjbj <devnull@localhost>
Tue, 5 Jan 1999 17:27:04 +0000 (17:27 +0000)
CVS patchset: 2650
CVS date: 1999/01/05 17:27:04

lib/rpmdb.c

index 675da45..bdc8a54 100644 (file)
@@ -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"));