From 9b42f061b37a00a0bcd314a830924803a956e17d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 1 Nov 2011 17:31:28 -0700 Subject: [PATCH] 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. --- common/os_posix.cpp | 1 + 1 file changed, 1 insertion(+) 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); -- 2.7.4