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

--HG--
branch : develop
This commit is contained in:
kervala 2015-11-21 17:39:49 +01:00
parent 35471ace88
commit d50c40c473

View file

@ -769,6 +769,12 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
}
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 ();
/////////////////////////////////////////////////////////
/// WARNING : NO MORE INSTRUCTION AFTER 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