Changed: Use LD_LIBRARY_PATH only when opening a document or URL
This commit is contained in:
parent
89f4807df2
commit
cbefb49b0d
1 changed files with 11 additions and 22 deletions
|
@ -784,12 +784,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
}
|
}
|
||||||
argv[i+1] = NULL;
|
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 ();
|
int status = vfork ();
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
/// WARNING : NO MORE INSTRUCTION AFTER VFORK !
|
/// WARNING : NO MORE INSTRUCTION AFTER VFORK !
|
||||||
|
@ -800,9 +794,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
char *err = strerror (errno);
|
char *err = strerror (errno);
|
||||||
if (log)
|
if (log)
|
||||||
nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err);
|
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)
|
else if (status == 0)
|
||||||
{
|
{
|
||||||
|
@ -818,9 +809,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//nldebug("LAUNCH: Successful launch '%s' with arg '%s'", programName.c_str(), arguments.c_str());
|
//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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -890,12 +878,6 @@ sint launchProgramAndWaitForResult(const std::string &programName, const std::st
|
||||||
CloseHandle(pi.hThread);
|
CloseHandle(pi.hThread);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// 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);
|
|
||||||
|
|
||||||
// program name is the only required string
|
// program name is the only required string
|
||||||
std::string command = programName;
|
std::string command = programName;
|
||||||
|
|
||||||
|
@ -905,9 +887,6 @@ sint launchProgramAndWaitForResult(const std::string &programName, const std::st
|
||||||
// execute the command
|
// execute the command
|
||||||
res = system(command.c_str());
|
res = system(command.c_str());
|
||||||
|
|
||||||
// restore previous LD_LIBRARY_PATH
|
|
||||||
setenv("LD_LIBRARY_PATH", previousEnv, 1);
|
|
||||||
|
|
||||||
if (res && log)
|
if (res && log)
|
||||||
nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res);
|
nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1253,8 +1232,18 @@ static bool openDocWithExtension (const char *document, const char *ext)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return launchProgram(command, document);
|
// 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);
|
||||||
|
|
||||||
|
bool res = launchProgram(command, document);
|
||||||
|
|
||||||
|
// restore previous LD_LIBRARY_PATH
|
||||||
|
setenv("LD_LIBRARY_PATH", previousEnv, 1);
|
||||||
|
|
||||||
|
return res;
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue