]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
registry: change reghook_cache_init() to return WERROR and use it in the callers.
authorMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 12:18:06 +0000 (14:18 +0200)
committerMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 13:33:47 +0000 (15:33 +0200)
Michael

source/registry/reg_cachehook.c
source/registry/reg_init_basic.c
source/registry/reg_init_full.c
source/registry/reg_init_smbconf.c

index bfdc0de5f573932e8091745ed0fc97bdef13b5c1..c7f099e134c25d84bbe43174b2283556d534b284 100644 (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;
 }
 
 /**********************************************************************
index e72765bdf2f1a8947b7a344532d96deaedcd3cac..72ab9d1e655f7c32e85105ef15c57dcd5193bc84 100644 (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;
 }
index ac3f66f1b26e8187d42cee19f3b0fc28a90f6cb7..8c834c4abb5c159b0f72dcee046c24d8aa9c2eff 100644 (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))
index 871141c1fda8d2ca2c280dc018fad3a87d32f419..bfc85afb22eeedcb48c3d2b21c42bffb34e6c38c 100644 (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;