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.
This commit is contained in:
Pierre-Loup A. Griffais 2019-02-03 18:18:51 -08:00 committed by Andrew Eikum
parent cd12d2a634
commit 4fb4c52acc

View File

@ -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){