App: Add mechanism to not propagate LD_PRELOAD

LD_PRELOAD is useful e.g. to preload custom malloc implementations
for profiling purposes. At times, it makes sense to not propagate
that to spawned child processes. This here allows to prevent that
by setting another variable, QTC_DO_NOT_PROPAGATE_LD_PRELOAD, in
the environment.

Change-Id: Ib8944685488a18a651d351b8a64dd8d7a7e48837
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-04-29 19:02:24 +02:00
parent ce428cfeef
commit 2a664afaa1

View File

@@ -459,6 +459,11 @@ int main(int argc, char **argv)
Options options = parseCommandLine(argc, argv);
applicationDirPath(argv[0]);
if (qEnvironmentVariableIsSet("QTC_DO_NOT_PROPAGATE_LD_PRELOAD")) {
Utils::Environment::modifySystemEnvironment(
{{"LD_PRELOAD", "", Utils::EnvironmentItem::Unset}});
}
if (options.userLibraryPath) {
if ((*options.userLibraryPath).isEmpty()) {
Utils::Environment::modifySystemEnvironment(