summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-04-04 19:02:10 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-04-04 19:02:10 +0000
commitff186870cba9f97cf1d60ce552b0eefad930c033 (patch)
tree0612073cd25cebe995c8fd141c154926a85a4d8b /usr.bin/tmux/window.c
parentc11891f34e66b20b4a5932d6dc2759ea07aa9fc1 (diff)
Run job commands explicitly in the global enviroment (which can be
modified with setenv -g) rather than with the environment tmux started with.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 1987d6e75eb..47f705a43a0 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.46 2010/04/04 18:48:37 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.47 2010/04/04 19:02:09 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -480,14 +480,11 @@ int
window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
const char *cwd, struct environ *env, struct termios *tio, char **cause)
{
- struct winsize ws;
- int mode;
- char *argv0, **varp, *var;
- ARRAY_DECL(, char *) varlist;
- struct environ_entry *envent;
- const char *ptr;
- struct termios tio2;
- u_int i;
+ struct winsize ws;
+ int mode;
+ char *argv0;
+ const char *ptr;
+ struct termios tio2;
if (wp->fd != -1) {
close(wp->fd);
@@ -530,20 +527,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
if (tcsetattr(STDIN_FILENO, TCSANOW, &tio2) != 0)
fatal("tcgetattr failed");
- 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);
- }
- RB_FOREACH(envent, environ, env) {
- if (envent->value != NULL)
- setenv(envent->name, envent->value, 1);
- }
+ environ_push(env);
server_signal_clear();
log_close();