mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Platform (Linux): fix invalid call to realpath(3)
This commit is contained in:
@@ -35,12 +35,13 @@ static void getExePath(FFPlatform* platform)
|
||||
else
|
||||
exePathLen--; // remove terminating NUL
|
||||
#else
|
||||
int exePathLen = 0;
|
||||
ssize_t exePathLen = readlink("/proc/self/path/a.out", exePath, sizeof(exePath) - 1);
|
||||
exePath[exePathLen] = '\0';
|
||||
#endif
|
||||
if (exePathLen > 0)
|
||||
{
|
||||
ffStrbufEnsureFree(&platform->exePath, PATH_MAX);
|
||||
if (realpath(platform->exePath.chars, exePath))
|
||||
if (realpath(exePath, platform->exePath.chars))
|
||||
ffStrbufRecalculateLength(&platform->exePath);
|
||||
else
|
||||
ffStrbufSetNS(&platform->exePath, (uint32_t) exePathLen, exePath);
|
||||
|
||||
Reference in New Issue
Block a user