s3:registry: don't use exported transaction wrappers in regdb_create_subkey()
authorMichael Adam <obnox@samba.org>
Tue, 7 Jul 2009 09:41:08 +0000 (11:41 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 15 Jul 2009 12:01:46 +0000 (14:01 +0200)
So that the regdb handle is again explicit and the core of the
function can be abstracted.

Michael

source3/registry/reg_backend_db.c

index 78ac64d5c136198d093ff66fd2dcbe9511ad4d83..6763558b0d53a779b5cd6e12f1258a6358ca4e35 100644 (file)
@@ -929,8 +929,10 @@ static WERROR regdb_create_subkey(const char *key, const char *subkey)
 
        talloc_free(subkeys);
 
-       werr = regdb_transaction_start();
-       W_ERROR_NOT_OK_GOTO_DONE(werr);
+       if (regdb->transaction_start(regdb) != 0) {
+               werr = WERR_REG_IO_FAILURE;
+               goto done;
+       }
 
        werr = regsubkey_ctr_init(mem_ctx, &subkeys);
        W_ERROR_NOT_OK_GOTO(werr, cancel);
@@ -950,19 +952,17 @@ static WERROR regdb_create_subkey(const char *key, const char *subkey)
                goto cancel;
        }
 
-       werr = regdb_transaction_commit();
-       if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(0, (__location__ " failed to commit transaction: %s\n",
-                        win_errstr(werr)));
+       if (regdb->transaction_commit(regdb) != 0) {
+               werr = WERR_REG_IO_FAILURE;
+               DEBUG(0, (__location__ " failed to commit transaction\n"));
        }
 
        goto done;
 
 cancel:
-       werr = regdb_transaction_cancel();
-       if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(0, (__location__ " failed to cancel transaction: %s\n",
-                        win_errstr(werr)));
+       if (regdb->transaction_cancel(regdb) != 0) {
+               werr = WERR_REG_IO_FAILURE;
+               DEBUG(0, (__location__ " failed to cancel transaction\n"));
        }
 
 done: