diff --git a/mdb.c b/mdb.c index ff75b6eb..fc326b65 100644 --- a/mdb.c +++ b/mdb.c @@ -9410,7 +9410,7 @@ int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *db /* make sure this is actually a DB */ MDB_node *node = NODEPTR(mc.mc_pg[mc.mc_top], mc.mc_ki[mc.mc_top]); if (!(node->mn_flags & F_SUBDATA)) - return MDB_INCOMPATIBLE; + return MDB_BAD_DBI; } else if (rc == MDB_NOTFOUND && (flags & MDB_CREATE)) { /* Create if requested */ data.mv_size = sizeof(MDB_db); diff --git a/mdb_chk.c b/mdb_chk.c index 0006cda4..e450e774 100644 --- a/mdb_chk.c +++ b/mdb_chk.c @@ -279,7 +279,7 @@ static long handle_maindb(size_t record_number, MDB_val *key, MDB_val* data) { rc = process_db(-1, name, handle_userdb, 0); free(name); - if (rc != MDB_NOTFOUND) + if (rc != MDB_BAD_DBI) return rc; return handle_userdb(record_number, key, data); @@ -302,7 +302,7 @@ static long process_db(MDB_dbi dbi, char *name, visitor *handler, int silent) if (0 > (int) dbi) { rc = mdb_dbi_open(txn, name, 0, &dbi); if (rc) { - if (rc != MDB_NOTFOUND) /* LY: mainDB's record is not a user's DB. */ { + if (!name || rc != MDB_BAD_DBI) /* LY: mainDB's record is not a user's DB. */ { error(" - mdb_open '%s' failed, error %d %s\n", name ? name : "main", rc, mdb_strerror(rc)); } diff --git a/mdb_dump.c b/mdb_dump.c index 7202d865..830cb082 100644 --- a/mdb_dump.c +++ b/mdb_dump.c @@ -298,7 +298,7 @@ int main(int argc, char *argv[]) if (!count) { fprintf(stderr, "%s: %s does not contain multiple databases\n", prog, envname); rc = MDB_NOTFOUND; - } else if (rc == MDB_NOTFOUND) { + } else if (rc == MDB_BAD_DBI) { rc = MDB_SUCCESS; } } else {