This is an automated email from the ASF dual-hosted git repository.
maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 2a12fa012 Make plugin DSO work on macOS (#9255)
2a12fa012 is described below
commit 2a12fa01283bcef007ec21e04db80059328529d9
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Mon Dec 19 17:42:07 2022 -0700
Make plugin DSO work on macOS (#9255)
dlopen doesn't return an error even if target file is invalid at all on
macOS. We need to call dlopen_preflight to examine target file.
With this fix, test_PluginDso passes on macOS.
---
proxy/http/remap/PluginDso.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/proxy/http/remap/PluginDso.cc b/proxy/http/remap/PluginDso.cc
index eb600a5f0..0c84012d7 100644
--- a/proxy/http/remap/PluginDso.cc
+++ b/proxy/http/remap/PluginDso.cc
@@ -90,7 +90,11 @@ PluginDso::load(std::string &error)
PluginDebug(_tag, "plugin '%s' modification time %ld",
_configPath.c_str(), _mtime);
/* Now attempt to load the plugin DSO */
+#if defined(darwin)
+ if (!dlopen_preflight(_runtimePath.c_str()) || (_dlh =
dlopen(_runtimePath.c_str(), RTLD_NOW | RTLD_LOCAL)) == nullptr) {
+#else
if ((_dlh = dlopen(_runtimePath.c_str(), RTLD_NOW | RTLD_LOCAL)) ==
nullptr) {
+#endif
#if defined(freebsd) || defined(openbsd)
char *err = (char *)dlerror();
#else