From ab9fc57bb899323c3fc6596118e51fd03297c364 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 23 May 2011 21:14:03 +0100 Subject: [PATCH] Use the process ID as process name when /proc/self/exe can't be read. /proc/self/exe is not available on setuid processes. --- os_posix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.43.0