From df08b5144c2cc2a75ae17dd2538bd16c506d73b5 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 4 May 2018 17:14:14 +0300 Subject: [PATCH] mdbx: backport - fix regression in 0.9.19 (ITS#8760). --- mdb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mdb.c b/mdb.c index 6a31b56b..082e823e 100644 --- a/mdb.c +++ b/mdb.c @@ -10204,8 +10204,11 @@ int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned flags, MDB_dbi *dbi) MDB_node *node = NODEPTR(mc.mc_pg[mc.mc_top], mc.mc_ki[mc.mc_top]); if (unlikely((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 */