diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-05-26 12:15:43 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-05-26 12:15:43 +0000 |
commit | 16b687c9134b1b16f5f96f89b9ed5772e91087f2 (patch) | |
tree | 5762ff4c043cf7c884ae7d97fdda1c2aa14059be /usr.bin/tmux/environ.c | |
parent | 3ee17cccb486305e7d7549b39a32efca92e91705 (diff) |
Just nuke environ instead of trying to unsetenv everything because that
doesn't necessarily work if there is an entry with an empty name.
Diffstat (limited to 'usr.bin/tmux/environ.c')
-rw-r--r-- | usr.bin/tmux/environ.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/usr.bin/tmux/environ.c b/usr.bin/tmux/environ.c index 752b3b88433..c4ccd10104a 100644 --- a/usr.bin/tmux/environ.c +++ b/usr.bin/tmux/environ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: environ.c,v 1.12 2016/01/19 15:59:12 nicm Exp $ */ +/* $OpenBSD: environ.c,v 1.13 2016/05/26 12:15:42 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -195,19 +195,11 @@ environ_update(const char *vars, struct environ *srcenv, void environ_push(struct environ *env) { - struct environ_entry *envent; - char *v; - - while (*environ != NULL) { - v = xstrdup(*environ); - v[strcspn(v, "=")] = '\0'; - - unsetenv(v); - free(v); - } + struct environ_entry *envent; + environ = xcalloc(1, sizeof *environ); RB_FOREACH(envent, environ, env) { - if (envent->value != NULL) + if (envent->value != NULL && *envent->name != '\0') setenv(envent->name, envent->value, 1); } } |