From: Carl Worth Date: Wed, 2 Nov 2011 00:31:28 +0000 (-0700) Subject: Mac OS X: Fix getProcessName() to avoid assertion failure in truncate X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=9b42f061b37a00a0bcd314a830924803a956e17d Mac OS X: Fix getProcessName() to avoid assertion failure in truncate 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. --- diff --git a/common/os_posix.cpp b/common/os_posix.cpp index b16d1bd..21a7e36 100644 --- a/common/os_posix.cpp +++ b/common/os_posix.cpp @@ -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);