mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-20 05:18:21 +08:00
mdbx: disallow begin txn if env not yet opened.
This commit is contained in:
parent
fbce45cb98
commit
204904df7c
2
mdbx.h
2
mdbx.h
@ -79,6 +79,7 @@ typedef DWORD mdbx_tid_t;
|
|||||||
#define MDBX_EROFS ERROR_FILE_READ_ONLY
|
#define MDBX_EROFS ERROR_FILE_READ_ONLY
|
||||||
#define MDBX_ENOSYS ERROR_NOT_SUPPORTED
|
#define MDBX_ENOSYS ERROR_NOT_SUPPORTED
|
||||||
#define MDBX_EIO ERROR_WRITE_FAULT
|
#define MDBX_EIO ERROR_WRITE_FAULT
|
||||||
|
#define MDBX_EPERM ERROR_INVALID_FUNCTION
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -97,6 +98,7 @@ typedef pthread_t mdbx_tid_t;
|
|||||||
#define MDBX_EROFS EROFS
|
#define MDBX_EROFS EROFS
|
||||||
#define MDBX_ENOSYS ENOSYS
|
#define MDBX_ENOSYS ENOSYS
|
||||||
#define MDBX_EIO EIO
|
#define MDBX_EIO EIO
|
||||||
|
#define MDBX_EPERM EPERM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -2434,6 +2434,9 @@ int mdbx_txn_begin(MDBX_env *env, MDBX_txn *parent, unsigned flags,
|
|||||||
return MDBX_PANIC;
|
return MDBX_PANIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlikely(!env->me_map))
|
||||||
|
return MDBX_EPERM;
|
||||||
|
|
||||||
flags &= MDBX_TXN_BEGIN_FLAGS;
|
flags &= MDBX_TXN_BEGIN_FLAGS;
|
||||||
flags |= env->me_flags & MDBX_WRITEMAP;
|
flags |= env->me_flags & MDBX_WRITEMAP;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user