diff options
Diffstat (limited to 'src/conf.c')
-rw-r--r-- | src/conf.c | 27 |
1 files changed, 13 insertions, 14 deletions
@@ -315,6 +315,7 @@ int conf_configure(void) goto out; } + conf_obj = mem_deref(conf_obj); err = conf_alloc(&conf_obj, file); if (err) goto out; @@ -324,7 +325,6 @@ int conf_configure(void) goto out; out: - conf_obj = mem_deref(conf_obj); return err; } @@ -333,23 +333,13 @@ int conf_configure(void) * Load all modules from config file * * @return 0 if success, otherwise errorcode + * + * @note conf_configure must be called first */ int conf_modules(void) { - char path[256], file[256]; int err; - err = conf_path_get(path, sizeof(path)); - if (err) - return err; - - if (re_snprintf(file, sizeof(file), "%s/config", path) < 0) - return ENOMEM; - - err = conf_alloc(&conf_obj, file); - if (err) - goto out; - err = module_init(conf_obj); if (err) { warning("conf: configure module parse error (%m)\n", err); @@ -364,7 +354,6 @@ int conf_modules(void) #endif out: - conf_obj = mem_deref(conf_obj); return err; } @@ -378,5 +367,15 @@ int conf_modules(void) */ struct conf *conf_cur(void) { + if (!conf_obj) { + warning("conf: no config object\n"); + } return conf_obj; } + + +void conf_close(void) +{ + mod_close(); + conf_obj = mem_deref(conf_obj); +} |