diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-06-14 07:42:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-06-14 07:42:42 +0000 |
commit | daa4a664fed350336c604364248f1627d118eb96 (patch) | |
tree | bd09dd6649418c08b2a77bfa5a0c8de74680e526 /usr.bin/tmux | |
parent | 21f6bec8eb5b7db9e2ad1365a3710672c3614f1c (diff) |
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')
-rw-r--r-- | usr.bin/tmux/cmd-string.c | 14 |
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 |