diff options
author | Thomas Adam <thomas@xteddy.org> | 2016-01-31 12:01:09 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2016-01-31 12:01:09 +0000 |
commit | 5fce21728e61b0d2be39f3bc9eba28d5f400f61e (patch) | |
tree | e056480e3d798bf72d99f049f492b73df72d86c1 /cmd-new-session.c | |
parent | 404379049a4cb5480c2b1c19634c869e46feb220 (diff) | |
parent | fa64b89ad7af8daf04c50b54fe8b45411750149e (diff) | |
download | rtmux-5fce21728e61b0d2be39f3bc9eba28d5f400f61e.tar.gz rtmux-5fce21728e61b0d2be39f3bc9eba28d5f400f61e.tar.bz2 rtmux-5fce21728e61b0d2be39f3bc9eba28d5f400f61e.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r-- | cmd-new-session.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c index b4bb37d5..ecbc5983 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -74,7 +74,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) struct environ *env; struct termios tio, *tiop; const char *newname, *target, *update, *errstr, *template; - const char *path, *cwd, *to_free; + const char *path, *cwd, *to_free = NULL; char **argv, *cmd, *cause, *cp; int detached, already_attached, idx, argc; u_int sx, sy; @@ -118,7 +118,12 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) } } - if ((target = args_get(args, 't')) == NULL) + if ((target = args_get(args, 't')) != NULL) { + if (groupwith == NULL) { + cmdq_error(cmdq, "no such session: %s", target); + goto error; + } + } else groupwith = NULL; /* Set -d if no client. */ @@ -132,7 +137,6 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) already_attached = 1; /* Get the new session working directory. */ - to_free = NULL; if (args_has(args, 'c')) { ft = format_create(cmdq, 0); format_defaults(ft, c, NULL, NULL, NULL); @@ -208,7 +212,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) if (!args_has(args, 't') && args->argc != 0) { argc = args->argc; argv = args->argv; - } else if (target == NULL) { + } else if (groupwith == NULL) { cmd = options_get_string(global_s_options, "default-command"); if (cmd != NULL && *cmd != '\0') { argc = 1; @@ -257,7 +261,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) * If a target session is given, this is to be part of a session group, * so add it to the group and synchronize. */ - if (args_has(args, 't')) { + if (groupwith != NULL) { session_group_add(groupwith, s); session_group_synchronize_to(s); session_select(s, RB_MIN(winlinks, &s->windows)->idx); |