From 4fb4c52accfd532f3808493e417bac611a5df1d1 Mon Sep 17 00:00:00 2001 From: "Pierre-Loup A. Griffais" Date: Sun, 3 Feb 2019 18:18:51 -0800 Subject: [PATCH] steamclient: resolve symlinks to steamclient.so before loading it Downstream code inside of it will use dladdr() to get path to its own code, in order to infer the runtime Steam installation path from it. Currently, it only gets the path to the canonical symlinks that point to it. --- lsteamclient/steamclient_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lsteamclient/steamclient_main.c b/lsteamclient/steamclient_main.c index 344473a5..27858ae2 100644 --- a/lsteamclient/steamclient_main.c +++ b/lsteamclient/steamclient_main.c @@ -210,7 +210,7 @@ static void (*steamclient_ReleaseThreadLocalMemory)(int); static int load_steamclient(void) { - char path[PATH_MAX]; + char path[PATH_MAX], resolved_path[PATH_MAX]; if(steamclient_lib) return 1; @@ -228,6 +228,10 @@ static int load_steamclient(void) #else snprintf(path, PATH_MAX, "%s/.steam/sdk32/steamclient.so", getenv("HOME")); #endif + if (realpath(path, resolved_path)){ + strncpy(path, resolved_path, PATH_MAX); + path[PATH_MAX - 1] = 0; + } #endif steamclient_lib = wine_dlopen(path, RTLD_NOW, NULL, 0); if(!steamclient_lib){