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

registry: change reghook_cache_init() to return WERROR and use it in the callers.

Michael
This commit is contained in:
Michael Adam 2008-04-13 14:18:06 +02:00
parent 4bfc0be55f
commit 2f4ca62dce
4 changed files with 26 additions and 9 deletions

View File

@ -54,18 +54,19 @@ static char *keyname_to_path(TALLOC_CTX *mem_ctx, const char *keyname)
Initialize the cache tree if it has not been initialized yet.
*********************************************************************/
bool reghook_cache_init( void )
WERROR reghook_cache_init(void)
{
if (cache_tree == NULL) {
cache_tree = pathtree_init(&regdb_ops, NULL);
if (cache_tree != NULL) {
DEBUG(10, ("reghook_cache_init: new tree with default "
"ops %p for key [%s]\n", (void *)&regdb_ops,
KEY_TREE_ROOT));
if (cache_tree == NULL) {
return WERR_NOMEM;
}
DEBUG(10, ("reghook_cache_init: new tree with default "
"ops %p for key [%s]\n", (void *)&regdb_ops,
KEY_TREE_ROOT));
}
return (cache_tree != NULL);
return WERR_OK;
}
/**********************************************************************

View File

@ -36,7 +36,12 @@ bool registry_init_basic(void)
}
regdb_close();
reghook_cache_init();
werr = reghook_cache_init();
if (!W_ERROR_IS_OK(werr)) {
DEBUG(1, ("Failed to initialize the reghook cache: %s\n",
dos_errstr(werr)));
return false;
}
return true;
}

View File

@ -85,7 +85,12 @@ bool init_registry( void )
/* build the cache tree of registry hooks */
reghook_cache_init();
werr = reghook_cache_init();
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0, ("Failed to initialize the reghook cache: %s\n",
dos_errstr(werr)));
goto fail;
}
for ( i=0; reg_hooks[i].keyname; i++ ) {
if (!reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops))

View File

@ -94,7 +94,13 @@ bool registry_init_smbconf(const char *keyname)
goto done;
}
reghook_cache_init();
werr = reghook_cache_init();
if (!W_ERROR_IS_OK(werr)) {
DEBUG(1, ("Failed to initialize the reghook cache: %s\n",
dos_errstr(werr)));
goto done;
}
if (!reghook_cache_add(keyname, &smbconf_reg_ops)) {
DEBUG(1, ("Failed to add smbconf reghooks to reghook cache\n"));
goto done;