summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2014-07-13 20:57:46 +0000
committernicm <nicm@openbsd.org>2014-07-13 20:57:46 +0000
commit566fc8f0c55ffbbd8f946187b3341d752fdd7d35 (patch)
tree6b16c60e3aa25b2e3373619ca22efb0f6b2f65a2 /usr.bin/tmux/cmd.c
parentNo libsa putchar wanted here actually (diff)
downloadwireguard-openbsd-566fc8f0c55ffbbd8f946187b3341d752fdd7d35.tar.xz
wireguard-openbsd-566fc8f0c55ffbbd8f946187b3341d752fdd7d35.zip
Show an error if cmd_find_session can't find the current session, like
the other functions.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r--usr.bin/tmux/cmd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 3d2d321a36e..9cfb6862e91 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.94 2014/05/13 08:08:32 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.95 2014/07/13 20:57:46 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -795,8 +795,11 @@ cmd_find_session(struct cmd_q *cmdq, const char *arg, int prefer_unattached)
int ambiguous;
/* A NULL argument means the current session. */
- if (arg == NULL)
- return (cmd_current_session(cmdq, prefer_unattached));
+ if (arg == NULL) {
+ if ((s = cmd_current_session(cmdq, prefer_unattached)) == NULL)
+ cmdq_error(cmdq, "can't establish current session");
+ return (s);
+ }
/* Lookup as pane id or window id. */
if ((wp = cmd_lookup_paneid(arg)) != NULL)
@@ -813,7 +816,9 @@ cmd_find_session(struct cmd_q *cmdq, const char *arg, int prefer_unattached)
/* An empty session name is the current session. */
if (*tmparg == '\0') {
free(tmparg);
- return (cmd_current_session(cmdq, prefer_unattached));
+ if ((s = cmd_current_session(cmdq, prefer_unattached)) == NULL)
+ cmdq_error(cmdq, "can't establish current session");
+ return (s);
}
/* Find the session, if any. */