]> git.cworth.org Git - apitrace/commitdiff
Use the process ID as process name when /proc/self/exe can't be read.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 23 May 2011 20:14:03 +0000 (21:14 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 23 May 2011 20:14:03 +0000 (21:14 +0100)
/proc/self/exe is not available on setuid processes.

os_posix.cpp

index ff320d0ebd6fbd9c4752119a2c8409e8d1906f1a..fdcaca9aa80685837efeccd1c2e9f1b5820d53a1 100644 (file)
@@ -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;