]> sourceware.org Git - systemtap.git/commitdiff
stapdyn: Make sure the module has a path component
authorJosh Stone <jistone@redhat.com>
Fri, 28 Sep 2012 21:42:14 +0000 (14:42 -0700)
committerJosh Stone <jistone@redhat.com>
Fri, 28 Sep 2012 21:48:45 +0000 (14:48 -0700)
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

index ffa342c8c9069036f0e3ae759a6b00ab999b3a80..bc388cac88001c34e08c2437e9c3bf7a7be4f95c 100644 (file)
@@ -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);
This page took 0.030058 seconds and 5 git commands to generate.