Ignore current cursor pos if it's out of bounds.
vmware
Howard Chu 13 years ago
parent d1a7fa267b
commit 23219ed32a
  1. 30
      libraries/libmdb/mdb.c

@ -3858,20 +3858,22 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data,
goto set1; goto set1;
} }
if (rc < 0) { if (rc < 0) {
/* This is definitely the right page, skip search_page */ if (mc->mc_ki[mc->mc_top] < NUMKEYS(mp)) {
if (mp->mp_flags & P_LEAF2) { /* This is definitely the right page, skip search_page */
nodekey.mv_data = LEAF2KEY(mp, if (mp->mp_flags & P_LEAF2) {
mc->mc_ki[mc->mc_top], nodekey.mv_size); nodekey.mv_data = LEAF2KEY(mp,
} else { mc->mc_ki[mc->mc_top], nodekey.mv_size);
leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); } else {
MDB_SET_KEY(leaf, &nodekey); leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]);
} MDB_SET_KEY(leaf, &nodekey);
rc = mc->mc_dbx->md_cmp(key, &nodekey); }
if (rc == 0) { rc = mc->mc_dbx->md_cmp(key, &nodekey);
/* current node was the one we wanted */ if (rc == 0) {
if (exactp) /* current node was the one we wanted */
*exactp = 1; if (exactp)
goto set1; *exactp = 1;
goto set1;
}
} }
rc = 0; rc = 0;
goto set2; goto set2;

Loading…
Cancel
Save