[sr-dev] git:master:795edca9: app_perl: do dlerror() after dlsym() fails to find exports

Daniel-Constantin Mierla miconda at gmail.com
Mon Mar 5 21:58:45 CET 2018


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-03-05T21:56:04+01:00

app_perl: do dlerror() after dlsym() fails to find exports

- some OSes do not reset dlerror after a successful dlsym(), pointing to
an older error case
- reported by GH #1465

---

Modified: src/core/sr_module.c

---

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

---

diff --git a/src/core/sr_module.c b/src/core/sr_module.c
index 8a195fc12d..f04d486908 100644
--- a/src/core/sr_module.c
+++ b/src/core/sr_module.c
@@ -619,6 +619,9 @@ int load_module(char* mod_path)
 	}
 	exp = (union module_exports_u*)dlsym(handle, "exports");
 	if(exp==NULL) {
+		error =(char*)dlerror();
+		LM_DBG("attempt to lookup exports structure failed - dlerror: %s\n",
+				(error)?error:"none");
 		/* 'exports' structure not found, look up for '_modulename_exports' */
 		mdir = strrchr(mod_path, '/');
 		if (!mdir) {




More information about the sr-dev mailing list