diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-09-02 01:08:32 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-09-02 01:08:32 +0000 |
commit | 5838ee1263bfa427412d389e0886f4083ce3d8d5 (patch) | |
tree | 8daff9479e48c4672aa5eee0822bf587be169ae8 | |
parent | b7cb7d10f90b61ebf6e733174dcfb6bfcf43b6bc (diff) | |
download | rtmux-5838ee1263bfa427412d389e0886f4083ce3d8d5.tar.gz rtmux-5838ee1263bfa427412d389e0886f4083ce3d8d5.tar.bz2 rtmux-5838ee1263bfa427412d389e0886f4083ce3d8d5.zip |
Sync OpenBSD patchset 306:
If forking a login shell or if SHELL is otherwise not useful, set it to the
default shell. Based on a diff from martynas@.
-rw-r--r-- | window.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.105 2009-09-02 01:02:44 tcunha Exp $ */ +/* $Id: window.c,v 1.106 2009-09-02 01:08:32 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -510,6 +510,11 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, log_close(); if (*wp->cmd != '\0') { + /* Set SHELL but only if it is currently not useful. */ + shell = getenv("SHELL"); + if (shell == NULL || *shell == '\0' || areshell(shell)) + setenv("SHELL", wp->shell, 1); + execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL); fatal("execl failed"); } @@ -520,6 +525,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, xasprintf(&argv0, "-%s", ptr + 1); else xasprintf(&argv0, "-%s", wp->shell); + setenv("SHELL", wp->shell, 1); execl(wp->shell, argv0, (char *) NULL); fatal("execl failed"); } |