summaryrefslogtreecommitdiff
path: root/lib/ntdb/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ntdb/lock.c')
-rw-r--r--lib/ntdb/lock.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ntdb/lock.c b/lib/ntdb/lock.c
index f6a811a3fa..4517e25568 100644
--- a/lib/ntdb/lock.c
+++ b/lib/ntdb/lock.c
@@ -188,15 +188,15 @@ static enum NTDB_ERROR ntdb_brlock(struct ntdb_context *ntdb,
{
int ret;
- if (ntdb->flags & NTDB_NOLOCK) {
- return NTDB_SUCCESS;
- }
-
if (rw_type == F_WRLCK && (ntdb->flags & NTDB_RDONLY)) {
return ntdb_logerr(ntdb, NTDB_ERR_RDONLY, NTDB_LOG_USE_ERROR,
"Write lock attempted on read-only database");
}
+ if (ntdb->flags & NTDB_NOLOCK) {
+ return NTDB_SUCCESS;
+ }
+
/* A 32 bit system cannot open a 64-bit file, but it could have
* expanded since then: check here. */
if ((size_t)(offset + len) != offset + len) {
@@ -533,8 +533,9 @@ enum NTDB_ERROR ntdb_allrecord_lock(struct ntdb_context *ntdb, int ltype,
enum NTDB_ERROR ecode;
ntdb_bool_err berr;
- if (ntdb->flags & NTDB_NOLOCK)
+ if (ntdb->flags & NTDB_NOLOCK) {
return NTDB_SUCCESS;
+ }
if (!check_lock_pid(ntdb, "ntdb_allrecord_lock", true)) {
return NTDB_ERR_LOCK;