aboutsummaryrefslogtreecommitdiff
path: root/cmd-find.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2016-03-03 16:01:11 +0000
committerThomas Adam <thomas@xteddy.org>2016-03-03 16:01:11 +0000
commit6c35d17800b5d745272c45bb4c71bde80780c415 (patch)
tree818b03a3534a51d98277f2badc0df2159522510d /cmd-find.c
parent45d62482daf5264c47d68ae07061ea99382c7a54 (diff)
parentdf0983af39922f2ee747a244c1c718ba7ca28910 (diff)
downloadrtmux-6c35d17800b5d745272c45bb4c71bde80780c415.tar.gz
rtmux-6c35d17800b5d745272c45bb4c71bde80780c415.tar.bz2
rtmux-6c35d17800b5d745272c45bb4c71bde80780c415.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-find.c')
-rw-r--r--cmd-find.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd-find.c b/cmd-find.c
index f6094ced..f95c143b 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -400,6 +400,7 @@ int
cmd_find_get_session(struct cmd_find_state *fs, const char *session)
{
struct session *s, *s_loop;
+ struct client *c;
log_debug("%s: %s", __func__, session);
@@ -416,6 +417,13 @@ cmd_find_get_session(struct cmd_find_state *fs, const char *session)
if (fs->s != NULL)
return (0);
+ /* Look for as a client. */
+ c = cmd_find_client(NULL, session, 1);
+ if (c != NULL && c->session != NULL) {
+ fs->s = c->session;
+ return (0);
+ }
+
/* Stop now if exact only. */
if (fs->flags & CMD_FIND_EXACT_SESSION)
return (-1);
@@ -1208,7 +1216,7 @@ cmd_find_client(struct cmd_q *cmdq, const char *target, int quiet)
const char *path;
/* A NULL argument means the current client. */
- if (target == NULL) {
+ if (cmdq != NULL && target == NULL) {
c = cmd_find_current_client(cmdq);
if (c == NULL && !quiet)
cmdq_error(cmdq, "no current client");