]> git.cworth.org Git - apitrace/commitdiff
Mac OS X: Fix getProcessName() to avoid assertion failure in truncate
authorCarl Worth <cworth@cworth.org>
Wed, 2 Nov 2011 00:31:28 +0000 (17:31 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 3 Nov 2011 11:44:31 +0000 (11:44 +0000)
Apparently _NSGetExecutablePath doesn't actually set the len field in
the case of successfully copying a value to buf. In this case, the
value in buf is properly terminated, so we can just use strlen to find
a legal value to use when calling truncate.

common/os_posix.cpp

index b16d1bdf1b1fff09ba6e31ae91f9e1382eabead5..21a7e3653e2787de4f0b75ce49280bbb9db93618 100644 (file)
@@ -89,6 +89,7 @@ getProcessName(void)
         *buf = 0;
         return path;
     }
+    len = strlen(buf);
 #else
     ssize_t len;
     len = readlink("/proc/self/exe", buf, size - 1);