diff options
author | nicm <nicm> | 2016-01-15 11:33:41 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-01-15 11:33:41 +0000 |
commit | d551ab8e5cfb00fbb7a79e7f0c3f4f2780fc6824 (patch) | |
tree | 8c426560cf2ebbbd2274d886249d024c55b327cd /environ.c | |
parent | 68d797587ef2acf1464a9390912e4a22e4db6482 (diff) |
Clear the environment properly by looping until it is empty rather than
looping over it (which may skip entries), from Brad King.
Diffstat (limited to 'environ.c')
-rw-r--r-- | environ.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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); |