From: Carl Worth Date: Wed, 24 Apr 2013 08:08:54 +0000 (-0700) Subject: Append to, rather than replace, the LD_PRELOAD value. X-Git-Url: https://git.cworth.org/git?p=fips;a=commitdiff_plain;h=56f628d7802e5807a47e3696ba0aab5c40461a07 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. --- 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);