s4-ldb: added ldb_transaction_cancel_noerr()
authorAndrew Tridgell <tridge@samba.org>
Fri, 23 Oct 2009 03:46:08 +0000 (14:46 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 23 Oct 2009 03:52:18 +0000 (14:52 +1100)
This will be used to allow cancelling of transactions in a child after
a fork()

source4/lib/ldb/common/ldb.c
source4/lib/ldb/configure.ac
source4/lib/ldb/include/ldb.h

index e9c924583e37c161e44898af3f7cc68949eb92c0..59727d75d01b00dc3b750d648e12f4257a38c9d6 100644 (file)
@@ -481,6 +481,19 @@ int ldb_transaction_cancel(struct ldb_context *ldb)
        return status;
 }
 
+/*
+  cancel a transaction with no error if no transaction is pending
+  used when we fork() to clear any parent transactions
+*/
+int ldb_transaction_cancel_noerr(struct ldb_context *ldb)
+{
+       if (ldb->transaction_active > 0) {
+               return ldb_transaction_cancel(ldb);
+       }
+       return LDB_SUCCESS;
+}
+
+
 /* autostarts a transacion if none active */
 static int ldb_autotransaction_request(struct ldb_context *ldb,
                                       struct ldb_request *req)
index a0fab6d786159a58f048c768aa1098f3b5ade42e..b280b4bd70d97aa4f3aa5be52759282e0a9c6891 100644 (file)
@@ -11,7 +11,7 @@ AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
 AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
 AC_DEFUN([SMB_EXT_LIB], [echo -n ""])
 AC_DEFUN([SMB_ENABLE], [echo -n ""])
-AC_INIT(ldb, 0.9.7)
+AC_INIT(ldb, 0.9.8)
 AC_CONFIG_SRCDIR([common/ldb.c])
 
 AC_LIBREPLACE_ALL_CHECKS
index 2511fecefb46e9001554fefa323ababff5d7502f..2d42596ec6c115de2a89d38e74ef29bd66e8b0ec 100644 (file)
@@ -1342,6 +1342,12 @@ int ldb_transaction_commit(struct ldb_context *ldb);
 */
 int ldb_transaction_cancel(struct ldb_context *ldb);
 
+/*
+  cancel a transaction with no error if no transaction is pending
+  used when we fork() to clear any parent transactions
+*/
+int ldb_transaction_cancel_noerr(struct ldb_context *ldb);
+
 
 /**
   return extended error information from the last call