Fix "method not permitted before handle's open method" on --verifydb
authorMichael Schroeder <mls@suse.de>
Fri, 13 May 2011 12:33:55 +0000 (15:33 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 13 May 2011 12:33:55 +0000 (15:33 +0300)
- In verify mode, the db is not really opened, thus it's an error
  to call dbiFlags() which calls db->get_open_flags().

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
lib/rpmdb.c

index 9cd5e35..6511bda 100644 (file)
@@ -165,7 +165,7 @@ static dbiIndex rpmdbOpenIndex(rpmdb db, rpmDbiTagVal rpmtag, int flags)
                                                uintId, uintCmp, NULL);
            }
            /* If primary got created, we can safely run without fsync */
-           if ((dbiFlags(dbi) & DBI_CREATED) || db->cfg.db_no_fsync) {
+           if ((!verifyonly && (dbiFlags(dbi) & DBI_CREATED)) || db->cfg.db_no_fsync) {
                rpmlog(RPMLOG_DEBUG, "disabling fsync on database\n");
                 db->cfg.db_no_fsync = 1;
                dbSetFSync(db->db_dbenv, 0);