Clear the environment properly by looping until it is empty rather than

looping over it (which may skip entries), from Brad King.
This commit is contained in:
nicm 2016-01-15 11:33:41 +00:00
parent 68d797587e
commit d551ab8e5c

View File

@ -196,10 +196,10 @@ void
environ_push(struct environ *env)
{
struct environ_entry *envent;
char **vp, *v;
char *v;
for (vp = environ; *vp != NULL; vp++) {
v = xstrdup(*vp);
while (*environ != NULL) {
v = xstrdup(*environ);
v[strcspn(v, "=")] = '\0';
unsetenv(v);