mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 01:06:19 +00:00
Fixed: Unable to open URLs under Linux while using Steam Runtime
This commit is contained in:
parent
70c47de7c8
commit
b3f294759e
1 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue