aboutsummaryrefslogtreecommitdiff
path: root/zencore/filesystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zencore/filesystem.cpp')
-rw-r--r--zencore/filesystem.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp
index f18d9cc0b..4d37a7f20 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -904,7 +904,7 @@ PathFromHandle(void* NativeHandle)
#elif ZEN_PLATFORM_LINUX
char Link[256];
char Path[64];
- sprintf(Path, "/proc/%d/fd/%d", getpid(), int(uintptr_t(NativeHandle)));
+ sprintf(Path, "/proc/self/fd/%d", int(uintptr_t(NativeHandle)));
ssize_t BytesRead = readlink(Path, Link, sizeof(Link) - 1);
if (BytesRead <= 0)
return std::filesystem::path();
@@ -926,9 +926,7 @@ GetRunningExecutablePath()
return {std::wstring_view(ExePath, PathLength)};
#elif ZEN_PLATFORM_LINUX
char Link[256];
- char Path[64];
- sprintf(Path, "/proc/%d/exe", getpid());
- ssize_t BytesRead = readlink(Path, Link, sizeof(Link) - 1);
+ ssize_t BytesRead = readlink("/proc/self/exe", Link, sizeof(Link) - 1);
if (BytesRead < 0)
return {};