mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
Fix MDB_LAST, reset cursor index
This commit is contained in:
parent
da3e4d78d6
commit
c057582573
@ -4705,19 +4705,19 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data)
|
|||||||
|
|
||||||
if (!(mc->mc_flags & C_EOF)) {
|
if (!(mc->mc_flags & C_EOF)) {
|
||||||
|
|
||||||
if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) {
|
if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) {
|
||||||
MDB_val lkey;
|
MDB_val lkey;
|
||||||
|
|
||||||
|
lkey.mv_size = MDB_MAXKEYSIZE+1;
|
||||||
|
lkey.mv_data = NULL;
|
||||||
|
rc = mdb_page_search(mc, &lkey, 0);
|
||||||
|
if (rc != MDB_SUCCESS)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
assert(IS_LEAF(mc->mc_pg[mc->mc_top]));
|
||||||
|
|
||||||
lkey.mv_size = MDB_MAXKEYSIZE+1;
|
|
||||||
lkey.mv_data = NULL;
|
|
||||||
rc = mdb_page_search(mc, &lkey, 0);
|
|
||||||
if (rc != MDB_SUCCESS)
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
assert(IS_LEAF(mc->mc_pg[mc->mc_top]));
|
|
||||||
|
|
||||||
mc->mc_ki[mc->mc_top] = NUMKEYS(mc->mc_pg[mc->mc_top]) - 1;
|
mc->mc_ki[mc->mc_top] = NUMKEYS(mc->mc_pg[mc->mc_top]) - 1;
|
||||||
}
|
|
||||||
mc->mc_flags |= C_INITIALIZED|C_EOF;
|
mc->mc_flags |= C_INITIALIZED|C_EOF;
|
||||||
leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]);
|
leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user