summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/getenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/getenv.c')
-rw-r--r--lib/libc/stdlib/getenv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c
index b6f6121..26de922 100644
--- a/lib/libc/stdlib/getenv.c
+++ b/lib/libc/stdlib/getenv.c
@@ -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));
OpenPOWER on IntegriCloud