From: José Fonseca Date: Mon, 23 May 2011 20:14:03 +0000 (+0100) Subject: Use the process ID as process name when /proc/self/exe can't be read. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=ab9fc57bb899323c3fc6596118e51fd03297c364;p=apitrace Use the process ID as process name when /proc/self/exe can't be read. /proc/self/exe is not available on setuid processes. --- diff --git a/os_posix.cpp b/os_posix.cpp index ff320d0..fdcaca9 100644 --- a/os_posix.cpp +++ b/os_posix.cpp @@ -77,8 +77,8 @@ GetProcessName(char *str, size_t size) ssize_t len; len = readlink("/proc/self/exe", szProcessPath, sizeof(szProcessPath) - 1); if (len == -1) { - *str = 0; - return false; + snprintf(str, size, "%i", (int)getpid()); + return true; } #endif szProcessPath[len] = 0;