From d19bc1b135d684fc2977a5674db052cfef83015c Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Wed, 25 Sep 2019 19:23:09 +0300 Subject: [PATCH] usrloc: Fix some incorrect startup checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On some misconfigured scripts (e.g. DB usrloc + db_url modparam, but without any SQL DB module loaded), the module would report some strange errors, instead of the more intuitive: WARNING:core:solve_module_dependencies: module usrloc depends on an sqldb module due to modparam working_mode_preset, but none was loaded! ERROR:core:main: failed to solve module dependencies Thanks to Vlad Pătrașcu for the catch! (cherry picked from commit 0b55ca32e74ec5d9b488de3226ba7ffe1d387764) --- modules/usrloc/ul_mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/usrloc/ul_mod.c b/modules/usrloc/ul_mod.c index 4d08d70436..62c09b9453 100644 --- a/modules/usrloc/ul_mod.c +++ b/modules/usrloc/ul_mod.c @@ -300,7 +300,7 @@ static module_dependency_t *get_deps_db_mode(param_export_t *param) static module_dependency_t *get_deps_wmode_preset(param_export_t *param) { - char *haystack = (char *)param->param_pointer; + char *haystack = *(char **)param->param_pointer; if (l_memmem(haystack, "sql-", strlen(haystack), strlen("sql-"))) return alloc_module_dep(MOD_TYPE_SQLDB, NULL, DEP_ABORT); @@ -313,7 +313,7 @@ static module_dependency_t *get_deps_wmode_preset(param_export_t *param) static module_dependency_t *get_deps_rr_persist(param_export_t *param) { - if (!strcasecmp((char *)param->param_pointer, "load-from-sql")) + if (!strcasecmp(*(char **)param->param_pointer, "load-from-sql")) return alloc_module_dep(MOD_TYPE_SQLDB, NULL, DEP_ABORT); return NULL;