|
|
@ -1698,7 +1698,7 @@ mdb_txn_renew(MDB_txn *txn) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int rc; |
|
|
|
int rc; |
|
|
|
|
|
|
|
|
|
|
|
if (!txn) |
|
|
|
if (! (txn && txn->mt_flags & MDB_TXN_RDONLY)) |
|
|
|
return EINVAL; |
|
|
|
return EINVAL; |
|
|
|
|
|
|
|
|
|
|
|
if (txn->mt_env->me_flags & MDB_FATAL_ERROR) { |
|
|
|
if (txn->mt_env->me_flags & MDB_FATAL_ERROR) { |
|
|
@ -1728,13 +1728,13 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) |
|
|
|
if ((env->me_flags & MDB_RDONLY) && !(flags & MDB_RDONLY)) |
|
|
|
if ((env->me_flags & MDB_RDONLY) && !(flags & MDB_RDONLY)) |
|
|
|
return EACCES; |
|
|
|
return EACCES; |
|
|
|
if (parent) { |
|
|
|
if (parent) { |
|
|
|
/* parent already has an active child txn */ |
|
|
|
/* Nested transactions: Max 1 child, write txns only, no writemap */ |
|
|
|
if (parent->mt_child) { |
|
|
|
if (parent->mt_child || |
|
|
|
|
|
|
|
(flags & MDB_RDONLY) || (parent->mt_flags & MDB_TXN_RDONLY) || |
|
|
|
|
|
|
|
(env->me_flags & MDB_WRITEMAP)) |
|
|
|
|
|
|
|
{ |
|
|
|
return EINVAL; |
|
|
|
return EINVAL; |
|
|
|
} |
|
|
|
} |
|
|
|
/* nested TXNs not supported here */ |
|
|
|
|
|
|
|
if (env->me_flags & MDB_WRITEMAP) |
|
|
|
|
|
|
|
return EINVAL; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
size = sizeof(MDB_txn) + env->me_maxdbs * (sizeof(MDB_db)+1); |
|
|
|
size = sizeof(MDB_txn) + env->me_maxdbs * (sizeof(MDB_db)+1); |
|
|
|
if (!(flags & MDB_RDONLY)) |
|
|
|
if (!(flags & MDB_RDONLY)) |
|
|
@ -3102,6 +3102,9 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mode_t mode) |
|
|
|
int oflags, rc, len, excl; |
|
|
|
int oflags, rc, len, excl; |
|
|
|
char *lpath, *dpath; |
|
|
|
char *lpath, *dpath; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (env->me_fd != INVALID_HANDLE_VALUE) |
|
|
|
|
|
|
|
return EINVAL; |
|
|
|
|
|
|
|
|
|
|
|
len = strlen(path); |
|
|
|
len = strlen(path); |
|
|
|
if (flags & MDB_NOSUBDIR) { |
|
|
|
if (flags & MDB_NOSUBDIR) { |
|
|
|
rc = len + sizeof(LOCKSUFF) + len + 1; |
|
|
|
rc = len + sizeof(LOCKSUFF) + len + 1; |
|
|
|