summaryrefslogtreecommitdiffstats
path: root/cmd-find.c
diff options
context:
space:
mode:
authornicm <nicm>2016-03-03 14:14:46 +0000
committernicm <nicm>2016-03-03 14:14:46 +0000
commitfa81d838dacb2dd05d4556db3cbcb3760b7d2c47 (patch)
tree7e945d95838531faf16ff562c49543832b6f318a /cmd-find.c
parentbcb41a09b3d3f0c61d2e98c0b91fcea52f745efb (diff)
Accept clients as sessions in cmd_find_get_session.
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 7ffc5f15..22511201 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -401,6 +401,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);
@@ -417,6 +418,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);
@@ -1209,7 +1217,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");