registry: change reghook_cache_add() to return WERROR instead of bool
authorMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 12:55:49 +0000 (14:55 +0200)
committerMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 13:33:48 +0000 (15:33 +0200)
Michael
(This used to be commit e65a999989c97c4c7b0af5093e0e89583691e9a8)

source3/registry/reg_cachehook.c
source3/registry/reg_init_full.c
source3/registry/reg_init_smbconf.c

index 66b9ae6c4ea94c213b2bb4f5f3489b1164550e15..6697a69356b34d26cbb460b70b3a97f69fe28e46 100644 (file)
@@ -79,13 +79,13 @@ WERROR reghook_cache_init(void)
  is not in the exact format that a SORTED_TREE expects.
  *********************************************************************/
 
-bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops)
+WERROR reghook_cache_add(const char *keyname, REGISTRY_OPS *ops)
 {
        WERROR werr;
        char *key = NULL;
 
        if ((keyname == NULL) || (ops == NULL)) {
-               return false;
+               return WERR_INVALID_PARAM;
        }
 
        werr = keyname_to_path(talloc_tos(), keyname, &key);
@@ -100,7 +100,7 @@ bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops)
 
 done:
        TALLOC_FREE(key);
-       return W_ERROR_IS_OK(werr);
+       return werr;
 }
 
 /**********************************************************************
index 8c834c4abb5c159b0f72dcee046c24d8aa9c2eff..e24cb61481b3aa4b069d5fbc97248d1e0e1fa1ce 100644 (file)
@@ -93,8 +93,10 @@ bool init_registry( void )
        }
 
        for ( i=0; reg_hooks[i].keyname; i++ ) {
-               if (!reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops))
+               werr = reghook_cache_add(reg_hooks[i].keyname, reg_hooks[i].ops);
+               if (!W_ERROR_IS_OK(werr)) {
                        goto fail;
+               }
        }
 
        if ( DEBUGLEVEL >= 20 )
index bfc85afb22eeedcb48c3d2b21c42bffb34e6c38c..fafaf7952f6f691e36a59a5b4e900b6b784b5bfc 100644 (file)
@@ -101,8 +101,10 @@ bool registry_init_smbconf(const char *keyname)
                goto done;
        }
 
-       if (!reghook_cache_add(keyname, &smbconf_reg_ops)) {
-               DEBUG(1, ("Failed to add smbconf reghooks to reghook cache\n"));
+       werr = reghook_cache_add(keyname, &smbconf_reg_ops);
+       if (!W_ERROR_IS_OK(werr)) {
+               DEBUG(1, ("Failed to add smbconf reghooks to reghook cache: "
+                         "%s\n", dos_errstr(werr)));
                goto done;
        }