Remove special handling for (DY)LD_LIBRARY_PATH in QProcess.
This provides the ability to pass a *real* clear environment to a QProcess, rather than (DY)LD_LIBRARY_PATH always being copied over from the current environment behind-the-scenes. This is important to users because passing a truly clear environment is now possible. [ChangeLog][Important Behavior Changes] (DY)LD_LIBRARY_PATH will no longer "stick" in the process environment when starting a QProcess. This means that if a QProcess is started with a clear environment, it will not specially inherit (DY)LD_LIBRARY_PATH from the parent process. This should not affect most applications, but if the old behavior is desired, one can simply pass a clear QProcessEnvironment with the (DY)LD_LIBRARY_PATH values added, to the QProcess. Change-Id: I51d1bc14905c5cc126fb02d91dddc2faade41a3c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a21a24ee48
commit
00540a8345
@ -299,18 +299,6 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environm
|
||||
if (environment.isEmpty())
|
||||
return 0;
|
||||
|
||||
// if LD_LIBRARY_PATH exists in the current environment, but
|
||||
// not in the environment list passed by the programmer, then
|
||||
// copy it over.
|
||||
#if defined(Q_OS_MAC)
|
||||
static const char libraryPath[] = "DYLD_LIBRARY_PATH";
|
||||
#else
|
||||
static const char libraryPath[] = "LD_LIBRARY_PATH";
|
||||
#endif
|
||||
const QByteArray envLibraryPath = qgetenv(libraryPath);
|
||||
bool needToAddLibraryPath = !envLibraryPath.isEmpty() &&
|
||||
!environment.contains(QProcessEnvironmentPrivate::Key(QByteArray(libraryPath)));
|
||||
|
||||
char **envp = new char *[environment.count() + 2];
|
||||
envp[environment.count()] = 0;
|
||||
envp[environment.count() + 1] = 0;
|
||||
@ -327,9 +315,6 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environm
|
||||
envp[(*envc)++] = ::strdup(key.constData());
|
||||
}
|
||||
|
||||
if (needToAddLibraryPath)
|
||||
envp[(*envc)++] = ::strdup(QByteArray(QByteArray(libraryPath) + '=' +
|
||||
envLibraryPath).constData());
|
||||
return envp;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user