diff options
author | Michael Adam <obnox@samba.org> | 2008-04-13 12:41:34 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-04-13 15:33:47 +0200 |
commit | 6b85938f275aad0fbb329ee46ed718ce8b101930 (patch) | |
tree | c4285bd7c32155ea0fb8d87412b3b147ad8a6344 /source3/registry | |
parent | bcb19766d6c18b847b0576ea86c0a0e468af78af (diff) | |
download | samba-6b85938f275aad0fbb329ee46ed718ce8b101930.tar.gz samba-6b85938f275aad0fbb329ee46ed718ce8b101930.tar.bz2 samba-6b85938f275aad0fbb329ee46ed718ce8b101930.zip |
registry: change regdb_init() to return WERROR instead of bool.
Michael
(This used to be commit c312852abce72bc167abee8b29fc699c4a643ca7)
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_backend_db.c | 12 | ||||
-rw-r--r-- | source3/registry/reg_init_basic.c | 12 | ||||
-rw-r--r-- | source3/registry/reg_init_full.c | 6 | ||||
-rw-r--r-- | source3/registry/reg_init_smbconf.c | 12 |
4 files changed, 19 insertions, 23 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index fd442d6327..e30d269721 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -318,16 +318,17 @@ bool init_registry_data(void) Open the registry database ***********************************************************************/ -bool regdb_init(void) +WERROR regdb_init(void) { const char *vstring = "INFO/version"; uint32 vers_id; + WERROR werr; if (regdb) { DEBUG(10, ("regdb_init: incrementing refcount (%d)\n", regdb_refcount)); regdb_refcount++; - return true; + return WERR_OK; } regdb = db_open_trans(NULL, state_path("registry.tdb"), 0, @@ -336,9 +337,10 @@ bool regdb_init(void) regdb = db_open_trans(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600); if (!regdb) { + werr = ntstatus_to_werror(map_nt_error_from_unix(errno)); DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n", state_path("registry.tdb"), strerror(errno) )); - return false; + return werr; } DEBUG(10,("regdb_init: Successfully created registry tdb\n")); @@ -357,14 +359,14 @@ bool regdb_init(void) if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("regdb_init: error storing %s = %d: %s\n", vstring, REGVER_V1, nt_errstr(status))); - return false; + return ntstatus_to_werror(status); } else { DEBUG(10, ("regdb_init: stored %s = %d\n", vstring, REGVER_V1)); } } - return true; + return WERR_OK; } /*********************************************************************** diff --git a/source3/registry/reg_init_basic.c b/source3/registry/reg_init_basic.c index 13f3c93383..9098bc4aec 100644 --- a/source3/registry/reg_init_basic.c +++ b/source3/registry/reg_init_basic.c @@ -24,17 +24,13 @@ bool registry_init_basic(void) { - int saved_errno = 0; + WERROR werr; DEBUG(10, ("registry_init_basic called\n")); - if (!regdb_init()) { - saved_errno = errno; - DEBUG(1, ("Can't open the registry")); - if (saved_errno) { - DEBUGADD(1, (": %s", strerror(saved_errno))); - } - DEBUGADD(1, (".\n")); + werr = regdb_init(); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, ("Can't open the registry: %s\n", dos_errstr(werr))); return false; } regdb_close(); diff --git a/source3/registry/reg_init_full.c b/source3/registry/reg_init_full.c index f171949e38..e9273a044c 100644 --- a/source3/registry/reg_init_full.c +++ b/source3/registry/reg_init_full.c @@ -65,11 +65,13 @@ REGISTRY_HOOK reg_hooks[] = { bool init_registry( void ) { int i; + WERROR werr; bool ret = false; - if ( !regdb_init() ) { + werr = regdb_init(); + if (!W_ERROR_IS_OK(werr)) { DEBUG(0, ("init_registry: failed to initialize the registry " - "tdb!\n")); + "(%s)\n", dos_errstr(werr))); goto fail; } diff --git a/source3/registry/reg_init_smbconf.c b/source3/registry/reg_init_smbconf.c index ff9cde749e..8d2fe53b53 100644 --- a/source3/registry/reg_init_smbconf.c +++ b/source3/registry/reg_init_smbconf.c @@ -69,8 +69,8 @@ done: */ bool registry_init_smbconf(const char *keyname) { + WERROR werr; bool ret = false; - int saved_errno = 0; DEBUG(10, ("registry_init_smbconf called\n")); @@ -80,13 +80,9 @@ bool registry_init_smbconf(const char *keyname) keyname = KEY_SMBCONF; } - if (!regdb_init()) { - saved_errno = errno; - DEBUG(1, ("Can't open the registry")); - if (saved_errno) { - DEBUGADD(1, (": %s", strerror(saved_errno))); - } - DEBUGADD(1, (".\n")); + werr = regdb_init(); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, ("Can't open the registry: %s\n", dos_errstr(werr))); goto done; } if (!init_registry_key(keyname)) { |