s3:registry: in deletekey_recursive, fix return code upon error.
authorMichael Adam <obnox@samba.org>
Sun, 30 Jan 2011 12:44:31 +0000 (13:44 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 31 Jan 2011 10:57:51 +0000 (11:57 +0100)
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

index ed2f44163f2ee63e2c5d8fa4a3f9f332628ed551..a7e8ac58fd154cc8262a31e644515e0dabb3a401 100644 (file)
@@ -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();