]> git.sur5r.net Git - openldap/blobdiff - libraries/libmdb/mdb.c
libmdb/.gitignore += test[45], Doxygen output
[openldap] / libraries / libmdb / mdb.c
index 21c71b2cdc925d9798d4c6760568f0db7d3fe441..b392826d07effad746b7ecadc8d00271b46b595c 100644 (file)
@@ -316,8 +316,8 @@ typedef uint16_t     indx_t;
  *     Since the database uses multi-version concurrency control, readers don't
  *     actually need any locking. This table is used to keep track of which
  *     readers are using data from which old transactions, so that we'll know
- *     when a particular old transaction is no longer in use, Old transactions
- *     that have freed any data pages can then have their freed pages reclaimed
+ *     when a particular old transaction is no longer in use. Old transactions
+ *     that have discarded any data pages can then have those pages reclaimed
  *     for use by a later write transaction.
  *
  *     The lock table is constructed such that reader slots are aligned with the
@@ -886,7 +886,7 @@ mdb_strerror(int err)
  * @param[in] buf the buffer to write into. Should always be #DKBUF.
  * @return The key in hexadecimal form.
  */
-static char *
+char *
 mdb_dkey(MDB_val *key, char *buf)
 {
        char *ptr = buf;
@@ -3283,9 +3283,11 @@ mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data,
                goto top;
        } else {
                int exact = 0;
-               rc = mdb_cursor_set(mc, key, NULL, MDB_SET, &exact);
+               MDB_val d2;
+               rc = mdb_cursor_set(mc, key, &d2, MDB_SET, &exact);
                if (flags == MDB_NOOVERWRITE && rc == 0) {
                        DPRINTF("duplicate key [%s]", DKEY(key));
+                       *data = d2;
                        return MDB_KEYEXIST;
                }
                if (rc && rc != MDB_NOTFOUND)