mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 06:08:42 +00:00
Fixed: Unable to open URLs under Linux while using Steam Runtime
This commit is contained in:
parent
d6bd6bef9c
commit
a026f6bada
1 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue