svn commit: samba r10541 - in
branches/tmp/samba4-winsrepl/source/nbt_server/wins: .
metze at samba.org
metze at samba.org
Tue Sep 27 13:05:34 GMT 2005
Author: metze
Date: 2005-09-27 13:05:33 +0000 (Tue, 27 Sep 2005)
New Revision: 10541
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10541
Log:
use a transaction when we allocate a new version
metze
Modified:
branches/tmp/samba4-winsrepl/source/nbt_server/wins/winsdb.c
Changeset:
Modified: branches/tmp/samba4-winsrepl/source/nbt_server/wins/winsdb.c
===================================================================
--- branches/tmp/samba4-winsrepl/source/nbt_server/wins/winsdb.c 2005-09-27 13:04:07 UTC (rev 10540)
+++ branches/tmp/samba4-winsrepl/source/nbt_server/wins/winsdb.c 2005-09-27 13:05:33 UTC (rev 10541)
@@ -33,6 +33,7 @@
*/
static uint64_t winsdb_allocate_version(struct wins_server *winssrv)
{
+ int trans;
int ret;
struct ldb_context *ldb = winssrv->wins_db;
struct ldb_dn *dn;
@@ -41,6 +42,9 @@
TALLOC_CTX *tmp_ctx = talloc_new(winssrv);
uint64_t maxVersion = 0;
+ trans = ldb_transaction_start(ldb);
+ if (trans != LDB_SUCCESS) goto failed;
+
dn = ldb_dn_explode(tmp_ctx, "CN=VERSION");
if (!dn) goto failed;
@@ -72,10 +76,14 @@
if (ret != 0) ret = ldb_add(ldb, msg);
if (ret != 0) goto failed;
+ trans = ldb_transaction_commit(ldb);
+ if (trans != LDB_SUCCESS) goto failed;
+
talloc_free(tmp_ctx);
return maxVersion;
failed:
+ if (trans == LDB_SUCCESS) ldb_transaction_cancel(ldb);
talloc_free(tmp_ctx);
return 0;
}
More information about the samba-cvs
mailing list