From 496feccad4a8b1e07d6cf441e2835462945b3c61 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 30 Mar 2017 14:27:55 +1300 Subject: [PATCH] ldb_tdb: Provide better debugging on end_trans failures Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- lib/ldb/ldb_tdb/ldb_tdb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index a5feea0284b..3dfd1ccf652 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -1153,11 +1153,12 @@ static int ltdb_prepare_commit(struct ldb_module *module) static int ltdb_end_trans(struct ldb_module *module) { + int ret; void *data = ldb_module_get_private(module); struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); if (!ltdb->prepared_commit) { - int ret = ltdb_prepare_commit(module); + ret = ltdb_prepare_commit(module); if (ret != LDB_SUCCESS) { return ret; } @@ -1167,7 +1168,12 @@ static int ltdb_end_trans(struct ldb_module *module) ltdb->prepared_commit = false; if (tdb_transaction_commit(ltdb->tdb) != 0) { - return ltdb_err_map(tdb_error(ltdb->tdb)); + ret = ltdb_err_map(tdb_error(ltdb->tdb)); + ldb_asprintf_errstring(ldb_module_get_ctx(module), + "Failure during tdb_transaction_commit(): %s -> %s", + tdb_errorstr(ltdb->tdb), + ldb_strerror(ret)); + return ret; } return LDB_SUCCESS; -- 2.11.4.GIT