From 56f628d7802e5807a47e3696ba0aab5c40461a07 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 24 Apr 2013 01:08:54 -0700 Subject: [PATCH] Append to, rather than replace, the LD_PRELOAD value. This is more polite for running things such as Steam games where there is already an LD_PRELOAD value in place. This way, both the Steam overlay and fips can get along happily. --- execute.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/execute.c b/execute.c index 3ed645a..527b8cb 100644 --- a/execute.c +++ b/execute.c @@ -301,10 +301,21 @@ fork_exec_with_fips_preload_and_wait (char * const argv[]) if (pid == 0) { void *ctx = talloc_new (NULL); char *lib_path; + char *ld_preload_value; lib_path = find_libfips_path (ctx, argv[0]); - setenv ("LD_PRELOAD", lib_path, 1); + ld_preload_value = getenv ("LD_PRELOAD"); + + if (ld_preload_value) { + ld_preload_value = talloc_asprintf(ctx, "%s:%s", + ld_preload_value, + lib_path); + } else { + ld_preload_value = lib_path; + } + + setenv ("LD_PRELOAD", ld_preload_value, 1); talloc_free (ctx); -- 2.43.0