From: Howard Chu Date: Thu, 24 Jul 2014 11:13:55 +0000 (-0700) Subject: more for mdb_cursor_count X-Git-Tag: OPENLDAP_REL_ENG_2_4_40~71^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=082bac1492c1aec8ac0fbe8cc10ac3f46424b836;p=openldap more for mdb_cursor_count return MDB_NOTFOUND if the cursor is empty --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 3e62b2e28f..84477c4285 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -6962,6 +6962,9 @@ mdb_cursor_count(MDB_cursor *mc, size_t *countp) if (!(mc->mc_flags & C_INITIALIZED)) 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]); if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { *countp = 1;