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

...early enough that txn state is left unchanged.
vl32b
Hallvard Furuseth 9 years ago
parent d7db12ad77
commit 4dea7d44fa
  1. 3
      libraries/liblmdb/mdb.c

@ -8602,6 +8602,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