From 4b4306eb4a55ae1c705464e3220d963651ce9b91 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 14:18:06 +0200 Subject: registry: change reghook_cache_init() to return WERROR and use it in the callers. Michael (This used to be commit 2f4ca62dce50225d67ba8643afba4199e1845c5f) --- source3/registry/reg_cachehook.c | 13 +++++++------ source3/registry/reg_init_basic.c | 7 ++++++- source3/registry/reg_init_full.c | 7 ++++++- source3/registry/reg_init_smbconf.c | 8 +++++++- 4 files changed, 26 insertions(+), 9 deletions(-) (limited to 'source3/registry') diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c index bfdc0de5f5..c7f099e134 100644 --- a/source3/registry/reg_cachehook.c +++ b/source3/registry/reg_cachehook.c @@ -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(®db_ops, NULL); - if (cache_tree != NULL) { - DEBUG(10, ("reghook_cache_init: new tree with default " - "ops %p for key [%s]\n", (void *)®db_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 *)®db_ops, + KEY_TREE_ROOT)); } - return (cache_tree != NULL); + return WERR_OK; } /********************************************************************** diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c index e72765bdf2..72ab9d1e65 100644 --- a/source3/registry/reg_init_basic.c +++ b/source3/registry/reg_init_basic.c @@ -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; } diff --git a/source3/registry/reg_init_full.c b/source3/registry/reg_init_full.c index ac3f66f1b2..8c834c4abb 100644 --- a/source3/registry/reg_init_full.c +++ b/source3/registry/reg_init_full.c @@ -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)) diff --git a/source3/registry/reg_init_smbconf.c b/source3/registry/reg_init_smbconf.c index 871141c1fd..bfc85afb22 100644 --- a/source3/registry/reg_init_smbconf.c +++ b/source3/registry/reg_init_smbconf.c @@ -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; -- cgit