[PATCH] [Msan] Fix the unit tests' PathToLoadable() to work on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Thu Feb 12 05:54:39 PST 2015


================
Comment at: lib/msan/tests/msan_test.cc:2850
@@ -2836,10 +2849,3 @@
 // directory.  Only use string routines that we intercept so far to do this.
-static int PathToLoadable(char *buf, size_t sz) {
-  const char *basename = "libmsan_loadable.x86_64.so";
-  char *argv0 = program_invocation_name;
-  char *last_slash = strrchr(argv0, '/');
-  assert(last_slash);
-  int res =
-      snprintf(buf, sz, "%.*s/%s", int(last_slash - argv0), argv0, basename);
-  assert(res >= 0);
-  return (size_t)res < sz ? 0 : res;
+static void PathToLoadable(char *buf, size_t sz) {
+  char program_path[kPathRoom];
----------------
Hm, with the returning type eliminated we may want to rename it to GetPathToLoadable()?

http://reviews.llvm.org/D7587

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list