diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-06-25 06:54:32 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-06-25 06:54:32 +0000 |
commit | dbbb297d5fc87f1e9f5bbd050a51f9d56dd0a26c (patch) | |
tree | 331346a1778d4541048ed9da507cbe05c5903977 /tmux.c | |
parent | be17ac1eb2d77ddfd23f92825dd7cd10fda87389 (diff) | |
download | rtmux-dbbb297d5fc87f1e9f5bbd050a51f9d56dd0a26c.tar.gz rtmux-dbbb297d5fc87f1e9f5bbd050a51f9d56dd0a26c.tar.bz2 rtmux-dbbb297d5fc87f1e9f5bbd050a51f9d56dd0a26c.zip |
If getcwd() fails, use the user's home directory, or /, instead of failing with
an error.
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |