浏览代码

srdb1 Check if the module is loaded, so the error message makes sense in case of missing module

If a module use a default database and it's not loaded, currently
Kamailio complains that the module doesn't implement an API function
instead of actually telling the Kamailian that the module is not loaded.
This patch modifies that behaviour.
Olle E. Johansson 10 年之前
父节点
当前提交
c1a1a1bb05
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      lib/srdb1/db.c

+ 4 - 0
lib/srdb1/db.c

@@ -199,6 +199,10 @@ int db_bind_mod(const str* mod, db_func_t* mydbf)
 		tmp = name;
 	}
 
+	if (!find_module_by_name(tmp)) {
+		LM_ERR("Module %s not found. Missing loadmodule? \n", tmp);
+		goto error;
+	}
 	dbind = (db_bind_api_f)find_mod_export(tmp, "db_bind_api", 0, 0);
 	if(dbind != NULL)
 	{