svn commit: samba r2979 - in branches/SAMBA_3_0/source/tdb: .

jra at samba.org jra at samba.org
Fri Oct 15 00:03:00 GMT 2004


Author: jra
Date: 2004-10-15 00:02:55 +0000 (Fri, 15 Oct 2004)
New Revision: 2979

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0/source/tdb&rev=2979&nolog=1

Log:
Fix incorrect locks/unlocks in tdb_lockkeys()/tdb_unlockkeys().
Spotted by Taj Khattra <taj.khattra at gmail.com>.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/tdb/tdb.c


Changeset:
Modified: branches/SAMBA_3_0/source/tdb/tdb.c
===================================================================
--- branches/SAMBA_3_0/source/tdb/tdb.c	2004-10-14 22:30:33 UTC (rev 2978)
+++ branches/SAMBA_3_0/source/tdb/tdb.c	2004-10-15 00:02:55 UTC (rev 2979)
@@ -1811,7 +1811,7 @@
 	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 @@
 	}
 	/* 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 @@
 	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);
 }
 



More information about the samba-cvs mailing list