]> git.cworth.org Git - fips/commitdiff
Append to, rather than replace, the LD_PRELOAD value.
authorCarl Worth <cworth@cworth.org>
Wed, 24 Apr 2013 08:08:54 +0000 (01:08 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 24 Apr 2013 22:27:31 +0000 (15:27 -0700)
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

index 3ed645a554a20dcedc4564ecb3e537ca2b4ef1ea..527b8cbabc68dd4358ef490c812ac5595aea27ff 100644 (file)
--- 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);