Fixed: Unable to open URLs under Linux while using Steam Runtime

This commit is contained in:
kervala 2015-11-21 17:39:49 +01:00
parent d6bd6bef9c
commit a026f6bada

View file

@ -768,6 +768,12 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
argv[i+1] = (char *) args[i].c_str();
}
argv[i+1] = NULL;
// save LD_LIBRARY_PATH
const char *previousEnv = getenv("LD_LIBRARY_PATH");
// clear LD_LIBRARY_PATH to avoid problems with Steam Runtime
setenv("LD_LIBRARY_PATH", "", 1);
int status = vfork ();
/////////////////////////////////////////////////////////
@ -779,10 +785,12 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
char *err = strerror (errno);
if (log)
nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err);
// restore previous LD_LIBRARY_PATH
setenv("LD_LIBRARY_PATH", previousEnv, 1);
}
else if (status == 0)
{
// Exec (the only allowed instruction after vfork)
status = execvp(programName.c_str(), &argv.front());
@ -795,6 +803,10 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
else
{
//nldebug("LAUNCH: Successful launch '%s' with arg '%s'", programName.c_str(), arguments.c_str());
// restore previous LD_LIBRARY_PATH
setenv("LD_LIBRARY_PATH", previousEnv, 1);
return true;
}
#else