From cc6e1c5119038688ace7f2118f3658852a25a8be Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Tue, 24 Jan 2017 20:51:23 +0300 Subject: [PATCH] mdbx: fix MDB_CURRENT for mdb_cursor_put() with MDB_DUPSORT. --- mdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mdb.c b/mdb.c index 6db4d996..2242109b 100644 --- a/mdb.c +++ b/mdb.c @@ -6902,8 +6902,11 @@ more: /* Was a single item before, must convert now */ if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { /* Just overwrite the current item */ - if (flags == MDB_CURRENT) + if (flags & MDB_CURRENT) { + if ((flags & MDB_NODUPDATA) && !mc->mc_dbx->md_dcmp(data, &olddata)) + return MDB_KEYEXIST; goto current; + } /* does data match? */ if (!mc->mc_dbx->md_dcmp(data, &olddata)) {