From a3c2342b0086461dfa6bc1b0ec4d75f267a163d4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 30 Jan 2011 13:44:31 +0100 Subject: [PATCH] s3:registry: in deletekey_recursive, fix return code upon error. correctly keep the werr from inside the transaction when the opearation inside the transaction fails. What is the correct behaviour if the cancel operation fails? --- source3/registry/reg_api.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index ed2f44163f..a7e8ac58fd 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -1122,14 +1122,21 @@ static WERROR reg_deletekey_recursive_trans(struct registry_key *parent, werr = reg_deletekey_recursive_internal(parent, path, del_key); if (!W_ERROR_IS_OK(werr)) { + WERROR werr2; + DEBUG(1, (__location__ " failed to delete key '%s' from key " "'%s': %s\n", path, parent->key->name, win_errstr(werr))); - werr = regdb_transaction_cancel(); - if (!W_ERROR_IS_OK(werr)) { + + werr2 = regdb_transaction_cancel(); + if (!W_ERROR_IS_OK(werr2)) { DEBUG(0, ("reg_deletekey_recursive_trans: " "error cancelling transaction: %s\n", - win_errstr(werr))); + win_errstr(werr2))); + /* + * return the original werr or the + * error from cancelling the transaction? + */ } } else { werr = regdb_transaction_commit(); -- 2.34.1