Skip rebuilding environ in setenv() only upon reuse of an active variable;
inactive variables should cause a rebuild of environ, otherwise, exec()'d processes will be missing a variable in environ that has been unset then set. Submitted by: Taku Yamamoto <taku@tackymt.homeip.net> Reviewed by: ache Approved by: wes (mentor) Approved by: re (kensmith)
This commit is contained in:
parent
3232788ef2
commit
21c376969a
@ -491,8 +491,8 @@ __setenv(const char *name, size_t nameLen, const char *value, int overwrite)
|
||||
envVars[envNdx].active = true;
|
||||
newEnvActive++;
|
||||
|
||||
/* No need to rebuild environ if the variable was reused. */
|
||||
if (reuse)
|
||||
/* No need to rebuild environ if an active variable was reused. */
|
||||
if (reuse && newEnvActive == envActive)
|
||||
return (0);
|
||||
else
|
||||
return (__rebuild_environ(newEnvActive));
|
||||
|
Loading…
Reference in New Issue
Block a user