[sr-dev] git:5.1:48c8f775: app_perl: do dlerror() after dlsym() fails to find exports

Daniel-Constantin Mierla miconda at gmail.com
Wed Mar 14 11:27:17 CET 2018


Module: kamailio
Branch: 5.1
Commit: 48c8f7751d701c8a6dd538280c5c1fa6129d141d
URL: https://github.com/kamailio/kamailio/commit/48c8f7751d701c8a6dd538280c5c1fa6129d141d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-03-14T11:21:56+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

(cherry picked from commit 795edca9215391f7c8f646895c083f8ac8853341)

---

Modified: src/core/sr_module.c

---

Diff:  https://github.com/kamailio/kamailio/commit/48c8f7751d701c8a6dd538280c5c1fa6129d141d.diff
Patch: https://github.com/kamailio/kamailio/commit/48c8f7751d701c8a6dd538280c5c1fa6129d141d.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