From a32b3386473e40ec8b94703f66f731a29dba68f7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 23 Oct 2009 14:46:08 +1100 Subject: [PATCH] s4-ldb: added ldb_transaction_cancel_noerr() This will be used to allow cancelling of transactions in a child after a fork() --- source4/lib/ldb/common/ldb.c | 13 +++++++++++++ source4/lib/ldb/configure.ac | 2 +- source4/lib/ldb/include/ldb.h | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index e9c924583e..59727d75d0 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -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) diff --git a/source4/lib/ldb/configure.ac b/source4/lib/ldb/configure.ac index a0fab6d786..b280b4bd70 100644 --- a/source4/lib/ldb/configure.ac +++ b/source4/lib/ldb/configure.ac @@ -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 diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 2511fecefb..2d42596ec6 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -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 -- 2.34.1