diff options
author | Tiago Cunha <tcunha@gmx.com> | 2010-07-02 02:49:19 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2010-07-02 02:49:19 +0000 |
commit | 63e76b555d8f3d40f9905fb65a58f6e7509d399d (patch) | |
tree | b9b003f298a235899b3d7aa03014d0f27bff13cd /cmd-new-session.c | |
parent | 13e7f060b1819ecdb1fcf88eee56293aa8b9f4cf (diff) | |
download | rtmux-63e76b555d8f3d40f9905fb65a58f6e7509d399d.tar.gz rtmux-63e76b555d8f3d40f9905fb65a58f6e7509d399d.tar.bz2 rtmux-63e76b555d8f3d40f9905fb65a58f6e7509d399d.zip |
Sync OpenBSD patchset 730:
Store the current working directory in the session, change the default-path
option to default to empty and make that mean that the stored session CWD is
used.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r-- | cmd-new-session.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c index d2de6ead..5f67691f 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $Id: cmd-new-session.c,v 1.77 2010-04-05 05:11:43 micahcowan Exp $ */ +/* $Id: cmd-new-session.c,v 1.78 2010-07-02 02:49:19 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -18,8 +18,10 @@ #include <sys/types.h> +#include <pwd.h> #include <string.h> #include <termios.h> +#include <unistd.h> #include "tmux.h" @@ -125,8 +127,9 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) struct window_pane *wp; struct environ env; struct termios tio, *tiop; - const char *update; - char *overrides, *cmd, *cwd, *cause; + struct passwd *pw; + const char *update, *cwd; + char *overrides, *cmd, *cause; int detached, idx; u_int sx, sy, i; @@ -198,8 +201,13 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) /* Get the new session working directory. */ if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL) cwd = ctx->cmdclient->cwd; - else - cwd = options_get_string(&global_s_options, "default-path"); + else { + pw = getpwuid(getuid()); + if (pw->pw_dir != NULL && *pw->pw_dir != '\0') + cwd = pw->pw_dir; + else + cwd = "/"; + } /* Find new session size. */ if (detached) { |