1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

ldb_tdb: Provide better debugging on prepare_commit failures

ltdb_index_transaction_commit() does LDB operations, sets the ldb
error string and returns LDB errors so we should not check the tdb
error code.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2017-03-30 14:26:23 +13:00
parent 1fd8ec23c7
commit a2a1962dc0

View File

@ -1121,6 +1121,7 @@ static int ltdb_start_trans(struct ldb_module *module)
static int ltdb_prepare_commit(struct ldb_module *module)
{
int ret;
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
@ -1128,15 +1129,21 @@ static int ltdb_prepare_commit(struct ldb_module *module)
return LDB_SUCCESS;
}
if (ltdb_index_transaction_commit(module) != 0) {
ret = ltdb_index_transaction_commit(module);
if (ret != LDB_SUCCESS) {
tdb_transaction_cancel(ltdb->tdb);
ltdb->in_transaction--;
return ltdb_err_map(tdb_error(ltdb->tdb));
return ret;
}
if (tdb_transaction_prepare_commit(ltdb->tdb) != 0) {
ret = ltdb_err_map(tdb_error(ltdb->tdb));
ltdb->in_transaction--;
return ltdb_err_map(tdb_error(ltdb->tdb));
ldb_asprintf_errstring(ldb_module_get_ctx(module),
"Failure during tdb_transaction_prepare_commit(): %s -> %s",
tdb_errorstr(ltdb->tdb),
ldb_strerror(ret));
return ret;
}
ltdb->prepared_commit = true;