From 2a664afaa1cf4c269868b6af853b32ca5595f0b4 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 29 Apr 2020 19:02:24 +0200 Subject: [PATCH] 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 --- src/app/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/main.cpp b/src/app/main.cpp index cd566f218f6..c56f22b642d 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -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(