summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/tdb/common/tdb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source4/lib/tdb/common/tdb.c b/source4/lib/tdb/common/tdb.c
index 4ae23bead7..c1deef80cd 100644
--- a/source4/lib/tdb/common/tdb.c
+++ b/source4/lib/tdb/common/tdb.c
@@ -2037,13 +2037,13 @@ int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[])
}
/* Finally, lock in order */
for (i = 0; i < number; i++)
- if (tdb_lock(tdb, i, F_WRLCK))
+ if (tdb_lock(tdb, BUCKET(tdb->lockedkeys[i+1]), F_WRLCK))
break;
/* If error, release locks we have... */
if (i < number) {
for ( j = 0; j < i; j++)
- tdb_unlock(tdb, j, F_WRLCK);
+ tdb_unlock(tdb, BUCKET(tdb->lockedkeys[j+1]), F_WRLCK);
SAFE_FREE(tdb->lockedkeys);
return TDB_ERRCODE(TDB_ERR_NOLOCK, -1);
}
@@ -2057,7 +2057,7 @@ void tdb_unlockkeys(TDB_CONTEXT *tdb)
if (!tdb->lockedkeys)
return;
for (i = 0; i < tdb->lockedkeys[0]; i++)
- tdb_unlock(tdb, tdb->lockedkeys[i+1], F_WRLCK);
+ tdb_unlock(tdb, BUCKET(tdb->lockedkeys[i+1]), F_WRLCK);
SAFE_FREE(tdb->lockedkeys);
}