[sr-dev] git:master:c1a1a1bb: srdb1 Check if the module is loaded, so the error message makes sense in case of missing module

Olle E. Johansson oej at edvina.net
Sat Sep 19 13:44:28 CEST 2015


Module: kamailio
Branch: master
Commit: c1a1a1bb054ee79af6ca44d262c8f73c725a2d90
URL: https://github.com/kamailio/kamailio/commit/c1a1a1bb054ee79af6ca44d262c8f73c725a2d90

Author: Olle E. Johansson <oej at edvina.net>
Committer: Olle E. Johansson <oej at edvina.net>
Date: 2015-09-19T12:43:02+01:00

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.

---

Modified: lib/srdb1/db.c

---

Diff:  https://github.com/kamailio/kamailio/commit/c1a1a1bb054ee79af6ca44d262c8f73c725a2d90.diff
Patch: https://github.com/kamailio/kamailio/commit/c1a1a1bb054ee79af6ca44d262c8f73c725a2d90.patch

---

diff --git a/lib/srdb1/db.c b/lib/srdb1/db.c
index e7323e3..fda8f9e 100644
--- a/lib/srdb1/db.c
+++ b/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)
 	{




More information about the sr-dev mailing list