From ddd5f1163d5dee1df34f606ac8d2aba35150337c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 15 Oct 2004 00:03:26 +0000 Subject: r2981: Fix incorrect locks/unlocks in tdb_lockkeys()/tdb_unlockkeys(). Spotted by Taj Khattra . Jeremy. (This used to be commit a7d92301bbf45cb9e475e4876fdbb37644ad5871) --- source4/lib/tdb/common/tdb.c | 6 +++--- 1 file 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); } -- cgit