mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-21 07:09:34 -05:00
Fix mdb_drop() if not deleting the DB record
This commit is contained in:
parent
77b1017b85
commit
2c70d0430a
1 changed files with 10 additions and 1 deletions
|
|
@ -5342,10 +5342,19 @@ int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del)
|
|||
mdb_cursor_close(mc);
|
||||
return rc;
|
||||
|
||||
if (del) {
|
||||
/* Can't delete the main DB */
|
||||
if (del && dbi > MAIN_DBI) {
|
||||
rc = mdb_del(txn, MAIN_DBI, &mc->mc_dbx->md_name, NULL);
|
||||
if (!rc)
|
||||
mdb_close(txn->mt_env, dbi);
|
||||
} else {
|
||||
txn->mt_dbflags[dbi] |= DB_DIRTY;
|
||||
txn->mt_dbs[dbi].md_depth = 0;
|
||||
txn->mt_dbs[dbi].md_branch_pages = 0;
|
||||
txn->mt_dbs[dbi].md_leaf_pages = 0;
|
||||
txn->mt_dbs[dbi].md_overflow_pages = 0;
|
||||
txn->mt_dbs[dbi].md_entries = 0;
|
||||
txn->mt_dbs[dbi].md_root = P_INVALID;
|
||||
}
|
||||
mdb_cursor_close(mc);
|
||||
return rc;
|
||||
|
|
|
|||
Loading…
Reference in a new issue