mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
ITS#8321 deinit empty cursors
Always unset C_INIT flag if the cursor's target DB has been deleted
This commit is contained in:
parent
83258ca81e
commit
b5ce8108e8
1 changed files with 8 additions and 1 deletions
|
|
@ -5284,8 +5284,11 @@ mdb_cursor_pop(MDB_cursor *mc)
|
|||
mc->mc_pg[mc->mc_top]->mp_pgno, DDBI(mc), (void *) mc));
|
||||
|
||||
mc->mc_snum--;
|
||||
if (mc->mc_snum)
|
||||
if (mc->mc_snum) {
|
||||
mc->mc_top--;
|
||||
} else {
|
||||
mc->mc_flags &= ~C_INITIALIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6941,6 +6944,7 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags)
|
|||
if (flags & MDB_NODUPDATA) {
|
||||
/* mdb_cursor_del0() will subtract the final entry */
|
||||
mc->mc_db->md_entries -= mc->mc_xcursor->mx_db.md_entries - 1;
|
||||
mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED;
|
||||
} else {
|
||||
if (!F_ISSET(leaf->mn_flags, F_SUBDATA)) {
|
||||
mc->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(leaf);
|
||||
|
|
@ -6978,6 +6982,8 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags)
|
|||
mc->mc_db->md_entries--;
|
||||
mc->mc_flags |= C_DEL;
|
||||
return rc;
|
||||
} else {
|
||||
mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED;
|
||||
}
|
||||
/* otherwise fall thru and delete the sub-DB */
|
||||
}
|
||||
|
|
@ -9767,6 +9773,7 @@ done:
|
|||
} else if (rc == MDB_NOTFOUND) {
|
||||
rc = MDB_SUCCESS;
|
||||
}
|
||||
mc->mc_flags &= ~C_INITIALIZED;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue