From f05a784712bc0857fa9697420e6600970ce8acb2 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@symas.com>
Date: Mon, 9 Apr 2012 05:01:37 -0700
Subject: [PATCH] ITS#7238 doc clarification

---
 libraries/libmdb/mdb.c | 3 +++
 libraries/libmdb/mdb.h | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c
index 724fdf1b2c..46fd2683d7 100644
--- a/libraries/libmdb/mdb.c
+++ b/libraries/libmdb/mdb.c
@@ -6277,6 +6277,9 @@ int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del)
 	if (!txn || !dbi || dbi >= txn->mt_numdbs)
 		return EINVAL;
 
+	if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY))
+		return EACCES;
+
 	rc = mdb_cursor_open(txn, dbi, &mc);
 	if (rc)
 		return rc;
diff --git a/libraries/libmdb/mdb.h b/libraries/libmdb/mdb.h
index 6017ef58fa..fa6daf672b 100644
--- a/libraries/libmdb/mdb.h
+++ b/libraries/libmdb/mdb.h
@@ -490,8 +490,8 @@ int  mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs);
 	/** @brief Create a transaction for use with the environment.
 	 *
 	 * The transaction handle may be discarded using #mdb_txn_abort() or #mdb_txn_commit().
-	 * @note Transactions may not span threads, a transaction must only be used by a
-	 * single thread.
+	 * @note Transactions may not span threads; a transaction must only be used by a
+	 * single thread. Also, a thread may only have a single transaction.
 	 * @note Cursors may not span transactions; each cursor must be opened and closed
 	 * within a single transaction.
 	 * @param[in] env An environment handle returned by #mdb_env_create()
@@ -579,7 +579,7 @@ int  mdb_txn_renew(MDB_txn *txn);
 	/** @brief Open a database in the environment.
 	 *
 	 * The database handle may be discarded by calling #mdb_close(). Only
-	 * one thread should call this function; it is not mutex-protected in
+	 * one thread at a time may call this function; it is not mutex-protected in
 	 * a read-only transaction.
 	 * @param[in] txn A transaction handle returned by #mdb_txn_begin()
 	 * @param[in] name The name of the database to open. If only a single
-- 
GitLab