ITS#7377 Catch mdb_put() to blocked/read-only txns

...early enough that txn state is left unchanged.
mdb.RE/0.9
Hallvard Furuseth 9 years ago
parent 01342bd5d2
commit 8901d9cfbc
  1. 3
      libraries/liblmdb/mdb.c

@ -8564,6 +8564,9 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi,
if (flags & ~(MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND|MDB_APPENDDUP)) if (flags & ~(MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND|MDB_APPENDDUP))
return EINVAL; return EINVAL;
if (txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED))
return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN;
mdb_cursor_init(&mc, txn, dbi, &mx); mdb_cursor_init(&mc, txn, dbi, &mx);
return mdb_cursor_put(&mc, key, data, flags); return mdb_cursor_put(&mc, key, data, flags);
} }

Loading…
Cancel
Save