diff options
author | Jeremy Allison <jra@samba.org> | 2004-10-15 00:03:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:54 -0500 |
commit | ddd5f1163d5dee1df34f606ac8d2aba35150337c (patch) | |
tree | 947bc9115cacfafd5e8f2b745b63438dc4315db8 /source4/lib | |
parent | acf657a7c228a920efe942b8776bf1bb1446f59c (diff) | |
download | samba-ddd5f1163d5dee1df34f606ac8d2aba35150337c.tar.gz samba-ddd5f1163d5dee1df34f606ac8d2aba35150337c.tar.bz2 samba-ddd5f1163d5dee1df34f606ac8d2aba35150337c.zip |
r2981: Fix incorrect locks/unlocks in tdb_lockkeys()/tdb_unlockkeys().
Spotted by Taj Khattra <taj.khattra@gmail.com>.
Jeremy.
(This used to be commit a7d92301bbf45cb9e475e4876fdbb37644ad5871)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/tdb/common/tdb.c | 6 |
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); } |