summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-string.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-06-14 07:42:41 +0000
committernicm <nicm@openbsd.org>2017-06-14 07:42:41 +0000
commit45c41df969405fecaf0b0847fda703175b8296e4 (patch)
treec3e8fd3f15f40d80440e70cd1c790642bc6cce8f /usr.bin/tmux/cmd-string.c
parentAdd missing error message when no target, GitHub issue 971. (diff)
downloadwireguard-openbsd-45c41df969405fecaf0b0847fda703175b8296e4.tar.xz
wireguard-openbsd-45c41df969405fecaf0b0847fda703175b8296e4.zip
Don't overwrite error message when it is available in
cmd_string_parse. Reported by Jimi Damon in GitHub issue 975.
Diffstat (limited to 'usr.bin/tmux/cmd-string.c')
-rw-r--r--usr.bin/tmux/cmd-string.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-string.c b/usr.bin/tmux/cmd-string.c
index a86181e3a66..968d303f356 100644
--- a/usr.bin/tmux/cmd-string.c
+++ b/usr.bin/tmux/cmd-string.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-string.c,v 1.28 2017/01/24 19:53:37 nicm Exp $ */
+/* $OpenBSD: cmd-string.c,v 1.29 2017/06/14 07:42:41 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -159,21 +159,19 @@ cmd_string_parse(const char *s, const char *file, u_int line, char **cause)
char **argv;
*cause = NULL;
- if (cmd_string_split(s, &argc, &argv) != 0)
- goto error;
+ if (cmd_string_split(s, &argc, &argv) != 0) {
+ xasprintf(cause, "invalid or unknown command: %s", s);
+ return (NULL);
+ }
if (argc != 0) {
cmdlist = cmd_list_parse(argc, argv, file, line, cause);
if (cmdlist == NULL) {
cmd_free_argv(argc, argv);
- goto error;
+ return (NULL);
}
}
cmd_free_argv(argc, argv);
return (cmdlist);
-
-error:
- xasprintf(cause, "invalid or unknown command: %s", s);
- return (NULL);
}
static void