summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-if-shell.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-05-25 07:15:53 +0000
committernicm <nicm@openbsd.org>2019-05-25 07:15:53 +0000
commit17a881a538306a337c3a75eb16a342ef284caf84 (patch)
tree200642669086a6cd7123240454f2953b779fbecd /usr.bin/tmux/cmd-if-shell.c
parentMake cmd_log_argv take a printf-like format for the prefix. (diff)
downloadwireguard-openbsd-17a881a538306a337c3a75eb16a342ef284caf84.tar.xz
wireguard-openbsd-17a881a538306a337c3a75eb16a342ef284caf84.zip
Fix error handling in if-shell.
Diffstat (limited to 'usr.bin/tmux/cmd-if-shell.c')
-rw-r--r--usr.bin/tmux/cmd-if-shell.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c
index 0ab1dc0599f..a625b0c26c1 100644
--- a/usr.bin/tmux/cmd-if-shell.c
+++ b/usr.bin/tmux/cmd-if-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-if-shell.c,v 1.61 2019/05/23 11:13:30 nicm Exp $ */
+/* $OpenBSD: cmd-if-shell.c,v 1.62 2019/05/25 07:15:53 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -159,7 +159,7 @@ cmd_if_shell_callback(struct job *job)
struct cmd_if_shell_data *cdata = job_get_data(job);
struct client *c = cdata->client;
struct mouse_event *m = &cdata->mouse;
- struct cmdq_item *new_item;
+ struct cmdq_item *new_item = NULL;
char *cmd;
int status;
struct cmd_parse_result *pr;
@@ -175,10 +175,10 @@ cmd_if_shell_callback(struct job *job)
pr = cmd_parse_from_string(cmd, &cdata->input);
switch (pr->status) {
case CMD_PARSE_EMPTY:
- new_item = NULL;
break;
case CMD_PARSE_ERROR:
- new_item = cmdq_get_error(pr->error);
+ if (cdata->item != NULL)
+ cmdq_error(cdata->item, "%s", pr->error);
free(pr->error);
break;
case CMD_PARSE_SUCCESS: