[PATCH] lib/tdb: additional changes for TDB_ALLOW_NESTING
Rusty Russell
rusty at rustcorp.com.au
Sun Aug 16 23:01:59 MDT 2009
The error code needs to be added to the strings, and errors should be logged,
particularly since this is a semantic change.
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
---
lib/tdb/common/error.c | 3 ++-
lib/tdb/common/transaction.c | 1 +
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/tdb/common/error.c b/lib/tdb/common/error.c
index 195ab23..eacd467 100644
--- a/lib/tdb/common/error.c
+++ b/lib/tdb/common/error.c
@@ -43,7 +43,8 @@ static struct tdb_errname {
{TDB_ERR_NOLOCK, "Lock exists on other keys"},
{TDB_ERR_EINVAL, "Invalid parameter"},
{TDB_ERR_NOEXIST, "Record does not exist"},
- {TDB_ERR_RDONLY, "write not permitted"} };
+ {TDB_ERR_RDONLY, "write not permitted"},
+ {TDB_ERR_NESTING, "Nested transactions not supported"} };
/* Error string for the last tdb error */
const char *tdb_errorstr(struct tdb_context *tdb)
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c
index d6d34fb..5d1ecc9 100644
--- a/lib/tdb/common/transaction.c
+++ b/lib/tdb/common/transaction.c
@@ -442,6 +442,7 @@ int tdb_transaction_start(struct tdb_context *tdb)
/* cope with nested tdb_transaction_start() calls */
if (tdb->transaction != NULL) {
if (!(tdb->flags & TDB_ALLOW_NESTING)) {
+ TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: nesting not allowed without TDB_ALLOW_NESTING\n"));
tdb->ecode = TDB_ERR_NESTING;
return -1;
}
--
1.6.0.4
More information about the samba-technical
mailing list