mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
ITS#7511 make sure cursor is marked valid after successful put
This commit is contained in:
parent
9fa0c3bf31
commit
27aaecc744
@ -4639,7 +4639,7 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data,
|
|||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case MDB_GET_CURRENT:
|
case MDB_GET_CURRENT:
|
||||||
if (!mc->mc_flags & C_INITIALIZED) {
|
if (!(mc->mc_flags & C_INITIALIZED)) {
|
||||||
rc = EINVAL;
|
rc = EINVAL;
|
||||||
} else {
|
} else {
|
||||||
MDB_page *mp = mc->mc_pg[mc->mc_top];
|
MDB_page *mp = mc->mc_pg[mc->mc_top];
|
||||||
@ -5181,6 +5181,11 @@ put_sub:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
|
/* If we succeeded and the key didn't exist before, make sure
|
||||||
|
* the cursor is marked valid.
|
||||||
|
*/
|
||||||
|
if (!rc && insert)
|
||||||
|
mc->mc_flags |= C_INITIALIZED;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5193,7 +5198,7 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags)
|
|||||||
if (F_ISSET(mc->mc_txn->mt_flags, MDB_TXN_RDONLY))
|
if (F_ISSET(mc->mc_txn->mt_flags, MDB_TXN_RDONLY))
|
||||||
return EACCES;
|
return EACCES;
|
||||||
|
|
||||||
if (!mc->mc_flags & C_INITIALIZED)
|
if (!(mc->mc_flags & C_INITIALIZED))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
rc = mdb_cursor_touch(mc);
|
rc = mdb_cursor_touch(mc);
|
||||||
|
Loading…
Reference in New Issue
Block a user