Преглед изворни кода

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)
 	{