diff options
| author | Martin Ridgers <[email protected]> | 2021-11-29 08:58:07 +0100 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-11-29 08:59:50 +0100 |
| commit | bb51d9246ab6d860c23fbf9d3d594adb59308869 (patch) | |
| tree | e287cf24949d2e15fe933fcebdaca50b2c03ec4d /zencore/filesystem.cpp | |
| parent | Child processes don't fully terminate until the parent waits on them (diff) | |
| download | zen-bb51d9246ab6d860c23fbf9d3d594adb59308869.tar.xz zen-bb51d9246ab6d860c23fbf9d3d594adb59308869.zip | |
Use the /proc/self mount to get information about ourselves
Diffstat (limited to 'zencore/filesystem.cpp')
| -rw-r--r-- | zencore/filesystem.cpp | 6 |
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 {}; |