mdbx: disallow begin txn if env not yet opened.

This commit is contained in:
Leo Yuriev 2017-06-06 18:28:04 +03:00
parent fbce45cb98
commit 204904df7c
2 changed files with 5 additions and 0 deletions

2
mdbx.h
View File

@ -79,6 +79,7 @@ typedef DWORD mdbx_tid_t;
#define MDBX_EROFS ERROR_FILE_READ_ONLY
#define MDBX_ENOSYS ERROR_NOT_SUPPORTED
#define MDBX_EIO ERROR_WRITE_FAULT
#define MDBX_EPERM ERROR_INVALID_FUNCTION
#else
@ -97,6 +98,7 @@ typedef pthread_t mdbx_tid_t;
#define MDBX_EROFS EROFS
#define MDBX_ENOSYS ENOSYS
#define MDBX_EIO EIO
#define MDBX_EPERM EPERM
#endif
#ifdef _MSC_VER

View File

@ -2434,6 +2434,9 @@ int mdbx_txn_begin(MDBX_env *env, MDBX_txn *parent, unsigned flags,
return MDBX_PANIC;
}
if (unlikely(!env->me_map))
return MDBX_EPERM;
flags &= MDBX_TXN_BEGIN_FLAGS;
flags |= env->me_flags & MDBX_WRITEMAP;