aboutsummaryrefslogtreecommitdiff
path: root/tmux.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-08 05:26:45 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-08 05:26:45 +0000
commit084d07f4eb5dc3d90e28725524147e66a25b869b (patch)
tree0cbfab6bd64ee71d1023e83930ec7e6b8aeea2da /tmux.c
parentb4efd1ca89132dcf24acd6dc7b1ccee369b7d90c (diff)
downloadrtmux-084d07f4eb5dc3d90e28725524147e66a25b869b.tar.gz
rtmux-084d07f4eb5dc3d90e28725524147e66a25b869b.tar.bz2
rtmux-084d07f4eb5dc3d90e28725524147e66a25b869b.zip
Just appending -l to $SHELL to create a login shell is wrong: -l is not POSIX,
and some people may use shells which do not support it. Instead, make an empty default-command option mean a login shell, and fork it with a - in argv[0] which is the method used by login(1). Also fix the automatic-rename code to handle this correctly and to strip a leading - if present.
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/tmux.c b/tmux.c
index 9f946b7c..c71c7264 100644
--- a/tmux.c
+++ b/tmux.c
@@ -209,7 +209,6 @@ main(int argc, char **argv)
struct cmd *cmd;
struct pollfd pfd;
struct hdr hdr;
- const char *shell;
struct passwd *pw;
char *s, *path, *label, *cause, *home, *pass = NULL;
char cwd[MAXPATHLEN];
@@ -270,6 +269,7 @@ main(int argc, char **argv)
options_init(&global_s_options, NULL);
options_set_number(&global_s_options, "bell-action", BELL_ANY);
options_set_number(&global_s_options, "buffer-limit", 9);
+ options_set_string(&global_s_options, "default-command", "%s", "");
options_set_number(&global_s_options, "display-time", 750);
options_set_number(&global_s_options, "history-limit", 2000);
options_set_number(&global_s_options, "lock-after-time", 0);
@@ -358,17 +358,6 @@ main(int argc, char **argv)
}
xfree(label);
- shell = getenv("SHELL");
- if (shell == NULL || *shell == '\0') {
- pw = getpwuid(getuid());
- if (pw != NULL)
- shell = pw->pw_shell;
- if (shell == NULL || *shell == '\0')
- shell = _PATH_BSHELL;
- }
- options_set_string(
- &global_s_options, "default-command", "exec %s -l", shell);
-
if (getcwd(cwd, sizeof cwd) == NULL) {
pw = getpwuid(getuid());
if (pw->pw_dir != NULL && *pw->pw_dir != '\0')