summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-10-15 00:02:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:58 -0500
commitdb2fa3bde8d216390c2eb101bc1aa9dcabed1d45 (patch)
treee6cf837cce155956e9fec9adbb6acbdbec636eaf /source3
parent6ae9b63f012b6cc3accd129016fc4c1cf2c29322 (diff)
downloadsamba-db2fa3bde8d216390c2eb101bc1aa9dcabed1d45.tar.gz
samba-db2fa3bde8d216390c2eb101bc1aa9dcabed1d45.tar.bz2
samba-db2fa3bde8d216390c2eb101bc1aa9dcabed1d45.zip
r2979: Fix incorrect locks/unlocks in tdb_lockkeys()/tdb_unlockkeys().
Spotted by Taj Khattra <taj.khattra@gmail.com>. Jeremy. (This used to be commit 365b203164bc813579013afb5dbb74f3604906c9)
Diffstat (limited to 'source3')
-rw-r--r--source3/tdb/tdb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index ae4e439c90..a825569fae 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -1811,7 +1811,7 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
if (tdb_already_open(st.st_dev, st.st_ino)) {
TDB_LOG((tdb, 2, "tdb_open_ex: "
"%s (%d,%d) is already open in this process\n",
- name, st.st_dev, st.st_ino));
+ name, (int)st.st_dev, (int)st.st_ino));
errno = EBUSY;
goto fail;
}
@@ -1982,13 +1982,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);
}
@@ -2002,7 +2002,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);
}