diff options
author | Michael Adam <obnox@samba.org> | 2008-03-20 14:01:13 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-03-20 15:01:52 +0100 |
commit | 88801114667d13f0f7b4fbb289b1d004194a7f18 (patch) | |
tree | d2fe4d4cfca193a849cbf75e6de62e96e3f331da /source3/registry | |
parent | 1f3139df25112c8c9a99aa14c7cc5d0f9a6b6cf5 (diff) | |
download | samba-88801114667d13f0f7b4fbb289b1d004194a7f18.tar.gz samba-88801114667d13f0f7b4fbb289b1d004194a7f18.tar.bz2 samba-88801114667d13f0f7b4fbb289b1d004194a7f18.zip |
registry: add a transaction wrapper to init_registry_key_internal().
Michael
(This used to be commit 8b9cff84d5c39e6d7c315d87ac2fdf7fc0d4e4c4)
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_backend_db.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index fc7d2bc2cf..e2e908cb84 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -178,6 +178,37 @@ fail: return ret; } +/** + * Initialize a key in the registry: + * create each component key of the specified path, + * wrapped in one db transaction. + */ +static bool init_registry_key(const char *add_path) +{ + if (regdb->transaction_start(regdb) == -1) { + DEBUG(0, ("init_registry_key: transaction_start failed\n")); + return false; + } + + if (!init_registry_key_internal(add_path)) { + goto fail; + } + + if (regdb->transaction_commit(regdb) == -1) { + DEBUG(0, ("init_registry_key: Could not commit transaction\n")); + return false; + } + + return true; + +fail: + if (regdb->transaction_cancel(regdb) == -1) { + smb_panic("init_registry_key: transaction_cancel failed\n"); + } + + return false; +} + /*********************************************************************** Open the registry data in the tdb ***********************************************************************/ |