summaryrefslogtreecommitdiff
path: root/lib/tdb/common/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tdb/common/open.c')
-rw-r--r--lib/tdb/common/open.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c
index 3fc9833863..1f948ff158 100644
--- a/lib/tdb/common/open.c
+++ b/lib/tdb/common/open.c
@@ -241,7 +241,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
fcntl(tdb->fd, F_SETFD, v | FD_CLOEXEC);
/* ensure there is only one process initialising at once */
- if (tdb->methods->brlock(tdb, F_WRLCK, OPEN_LOCK, 1, TDB_LOCK_WAIT) == -1) {
+ if (tdb_nest_lock(tdb, OPEN_LOCK, F_WRLCK, TDB_LOCK_WAIT) == -1) {
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to get open lock on %s: %s\n",
name, strerror(errno)));
goto fail; /* errno set by tdb_brlock */
@@ -357,8 +357,9 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
/* Internal (memory-only) databases skip all the code above to
* do with disk files, and resume here by releasing their
* open lock and hooking into the active list. */
- if (tdb->methods->brunlock(tdb, F_WRLCK, OPEN_LOCK, 1) == -1)
+ if (tdb_nest_unlock(tdb, OPEN_LOCK, F_WRLCK, false) == -1) {
goto fail;
+ }
tdb->next = tdbs;
tdbs = tdb;
return tdb;