소스 검색

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