summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/environ.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/usr.bin/tmux/environ.c b/usr.bin/tmux/environ.c
index 38e7e7c0127..f5011be6f2b 100644
--- a/usr.bin/tmux/environ.c
+++ b/usr.bin/tmux/environ.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: environ.c,v 1.7 2015/01/25 16:53:46 nicm Exp $ */
+/* $OpenBSD: environ.c,v 1.8 2015/05/07 07:35:31 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -157,23 +157,16 @@ environ_update(const char *vars, struct environ *srcenv,
void
environ_push(struct environ *env)
{
- ARRAY_DECL(, char *) varlist;
- struct environ_entry *envent;
- char **varp, *var;
- u_int i;
-
- ARRAY_INIT(&varlist);
- for (varp = environ; *varp != NULL; varp++) {
- var = xstrdup(*varp);
- var[strcspn(var, "=")] = '\0';
- ARRAY_ADD(&varlist, var);
- }
- for (i = 0; i < ARRAY_LENGTH(&varlist); i++) {
- var = ARRAY_ITEM(&varlist, i);
- unsetenv(var);
- free(var);
+ struct environ_entry *envent;
+ char **vp, *v;
+
+ for (vp = environ; *vp != NULL; vp++) {
+ v = xstrdup(*vp);
+ v[strcspn(v, "=")] = '\0';
+
+ unsetenv(v);
+ free(v);
}
- ARRAY_FREE(&varlist);
RB_FOREACH(envent, environ, env) {
if (envent->value != NULL)