1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

registry: add a transaction wrapper to init_registry_key_internal().

Michael
(This used to be commit 8b9cff84d5)
This commit is contained in:
Michael Adam 2008-03-20 14:01:13 +01:00
parent 1f3139df25
commit 8880111466

View File

@ -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
***********************************************************************/