From 10e8af83ba66e2c734f9caec7e62ff8d9bce3478 Mon Sep 17 00:00:00 2001 From: MysterD Date: Mon, 14 Jun 2021 23:31:22 -0700 Subject: [PATCH] Fixed how Linux registers the discord executable --- src/pc/network/discord/discord.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pc/network/discord/discord.c b/src/pc/network/discord/discord.c index c598cd77..e949f709 100644 --- a/src/pc/network/discord/discord.c +++ b/src/pc/network/discord/discord.c @@ -104,8 +104,10 @@ static void register_launch_command(void) { } GetModuleFileName(hModule, cmd, sizeof(cmd)); #else - rc = readlink("/proc/self/exe", cmd, sizeof(MAX_LAUNCH_CMD) - 1); - if (rc) { + char path[MAX_LAUNCH_CMD] = { 0 }; + snprintf(path, MAX_LAUNCH_CMD - 1, "/proc/%d/exe", getpid()); + rc = readlink(path, cmd, MAX_LAUNCH_CMD - 1); + if (rc <= 0) { LOG_ERROR("unable to retrieve absolute path! rc = %d", rc); return; }