Skip to content
Snippets Groups Projects
Commit 082bac14 authored by Howard Chu's avatar Howard Chu
Browse files

more for mdb_cursor_count

return MDB_NOTFOUND if the cursor is empty
parent 6cb11666
No related branches found
No related tags found
No related merge requests found
...@@ -6962,6 +6962,9 @@ mdb_cursor_count(MDB_cursor *mc, size_t *countp) ...@@ -6962,6 +6962,9 @@ mdb_cursor_count(MDB_cursor *mc, size_t *countp)
if (!(mc->mc_flags & C_INITIALIZED)) if (!(mc->mc_flags & C_INITIALIZED))
return EINVAL; return EINVAL;
if (!mc->mc_snum || (mc->mc_flags & C_EOF))
return MDB_NOTFOUND;
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]);
if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) {
*countp = 1; *countp = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment