From: Howard Chu Date: Sun, 21 Apr 2013 02:30:06 +0000 (-0700) Subject: Fix MDB_LAST, reset cursor index X-Git-Tag: OPENLDAP_REL_ENG_2_4_36~69^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c0575825730dd2aab4031100b25d632a3d052447;p=openldap Fix MDB_LAST, reset cursor index --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index d3bb4da8ce..30475ac7e5 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -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_INITIALIZED) || mc->mc_top) { - MDB_val lkey; + if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) { + 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; leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]);