From 4e829f566684a2c8298bb35d970a316637047f36 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 28 Sep 2012 14:42:14 -0700 Subject: [PATCH] stapdyn: Make sure the module has a path component We don't ever want library-path searching for the probe module, but that's what dlopen will do if there's no '/' in the filename. * stapdyn/stapdyn.cxx (main): If the module has no path component, give it the minimum "./" leader. --- stapdyn/stapdyn.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/stapdyn/stapdyn.cxx b/stapdyn/stapdyn.cxx index ffa342c8c..bc388cac8 100644 --- a/stapdyn/stapdyn.cxx +++ b/stapdyn/stapdyn.cxx @@ -286,8 +286,17 @@ main(int argc, char * const argv[]) } } + string module_str; if (optind == argc - 1) - module = argv[optind]; + { + module_str = argv[optind]; + + // dlopen does a library-path search if the filename doesn't have any + // path components. We never want that, so give it a minimal ./ path. + if (module_str.find('/') == string::npos) + module_str.insert(0, "./"); + module = module_str.c_str(); + } if (!module) usage (1); -- 2.43.5