From: Howard Chu Date: Thu, 26 Oct 2017 18:04:37 +0000 (+0100) Subject: ITS#8760 fix regression in 0.9.19 X-Git-Tag: LMDB_0.9.22~12 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a4d9a75a1e3b907392f3e00586da4611bbfe09bb;hp=-c;p=openldap ITS#8760 fix regression in 0.9.19 --- a4d9a75a1e3b907392f3e00586da4611bbfe09bb diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 87ff230833..e9d385c8ae 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -9758,8 +9758,11 @@ int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *db MDB_node *node = NODEPTR(mc.mc_pg[mc.mc_top], mc.mc_ki[mc.mc_top]); if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) != F_SUBDATA) return MDB_INCOMPATIBLE; - } else if (! (rc == MDB_NOTFOUND && (flags & MDB_CREATE))) { - return rc; + } else { + if (rc != MDB_NOTFOUND || !(flags & MDB_CREATE)) + return rc; + if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) + return EACCES; } /* Done here so we cannot fail after creating a new DB */