aboutsummaryrefslogtreecommitdiff
path: root/tmux.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tmux.c b/tmux.c
index 915d0acd..84e5a029 100644
--- a/tmux.c
+++ b/tmux.c
@@ -371,8 +371,11 @@ main(int argc, char **argv)
&global_options, "default-command", "exec %s -l", shell);
if (getcwd(cwd, sizeof cwd) == NULL) {
- log_warn("getcwd");
- exit(1);
+ pw = getpwuid(getuid());
+ if (pw->pw_dir != NULL && *pw->pw_dir != '\0')
+ strlcpy(cwd, pw->pw_dir, sizeof cwd);
+ else
+ strlcpy(cwd, "/", sizeof cwd);
}
options_set_string(&global_options, "default-path", "%s", cwd);