mirror of https://github.com/BOINC/boinc.git
LIB: A more efficient fix than commit 87d3cb5
to eliminate the spurious 'dyld: DYLD_ environment variables being ignored' stderr messages on Mac OS X 10.8.
This commit is contained in:
parent
6ad292cbdc
commit
5c475782fe
|
@ -52,7 +52,6 @@ int procinfo_setup(PROC_MAP& pm) {
|
||||||
char* lf;
|
char* lf;
|
||||||
static long iBrandID = -1;
|
static long iBrandID = -1;
|
||||||
int priority;
|
int priority;
|
||||||
char env1[1024], env2[1024];
|
|
||||||
|
|
||||||
if (iBrandID < 0) {
|
if (iBrandID < 0) {
|
||||||
iBrandID = BOINC_BRAND_ID;
|
iBrandID = BOINC_BRAND_ID;
|
||||||
|
@ -66,14 +65,6 @@ 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
|
#if SHOW_TIMING
|
||||||
UnsignedWide start, end, elapsed;
|
UnsignedWide start, end, elapsed;
|
||||||
|
|
||||||
|
@ -110,8 +101,11 @@ int procinfo_setup(PROC_MAP& pm) {
|
||||||
// This eliminates the need to install our own application which runs setuid
|
// This eliminates the need to install our own application which runs setuid
|
||||||
// root; this was perceived by some users as a security risk.
|
// root; this was perceived by some users as a security risk.
|
||||||
|
|
||||||
|
// Under OS 10.8.x (only) ps writes a spurious warning to stderr if called
|
||||||
fd = popen("ps -axcopid,ppid,rss,vsz,pagein,pri,time,command", "r");
|
// from a process that has the DYLD_LIBRARY_PATH environment variable set.
|
||||||
|
// "env -i command" prevents the command from inheriting the caller's
|
||||||
|
// environment, which avoids the spurious warning.
|
||||||
|
fd = popen("env -i ps -axcopid,ppid,rss,vsz,pagein,pri,time,command", "r");
|
||||||
if (!fd) return ERR_FOPEN;
|
if (!fd) return ERR_FOPEN;
|
||||||
|
|
||||||
// Skip over the header line
|
// Skip over the header line
|
||||||
|
@ -174,11 +168,5 @@ int procinfo_setup(PROC_MAP& pm) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
find_children(pm);
|
find_children(pm);
|
||||||
|
|
||||||
// Put back the environment variables previously removed
|
|
||||||
//
|
|
||||||
setenv("DYLD_LIBRARY_PATH", env1, 1);
|
|
||||||
setenv("LD_LIBRARY_PATH", env2, 1);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue