From 87d3cb5474007a327d5b0c2e92a95046965231fe Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 3 Jul 2014 12:10:28 -0400 Subject: [PATCH] LIB: Get rid of the spurious 'dyld: DYLD_ environment variables being ignored' stderr messages on Mac OS X 10.8 machines across all of our apps. --- lib/procinfo_mac.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/procinfo_mac.cpp b/lib/procinfo_mac.cpp index 705c534c6b..e3031d1c89 100644 --- a/lib/procinfo_mac.cpp +++ b/lib/procinfo_mac.cpp @@ -52,7 +52,8 @@ int procinfo_setup(PROC_MAP& pm) { char* lf; static long iBrandID = -1; int priority; - + char env1[1024], env2[1024]; + if (iBrandID < 0) { iBrandID = BOINC_BRAND_ID; @@ -65,6 +66,14 @@ int procinfo_setup(PROC_MAP& pm) { } } + // Temporarily remove some environment vraiables which cause 'ps' to write + // some stuff to stderr on 10.8 + // + safe_strcpy(getenv("DYLD_LIBRARY_PATH"), env1); + safe_strcpy(getenv("LD_LIBRARY_PATH"), env2); + unsetenv("DYLD_LIBRARY_PATH"); + unsetenv("LD_LIBRARY_PATH"); + #if SHOW_TIMING UnsignedWide start, end, elapsed; @@ -165,5 +174,11 @@ int procinfo_setup(PROC_MAP& pm) { #endif find_children(pm); + + // Put back the environment variables previously removed + // + setenv("DYLD_LIBRARY_PATH", env1, 1); + setenv("LD_LIBRARY_PATH", env2, 1); + return 0; }