Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2017-06-14 10:01:10 +01:00
commit 91dec25fc9
2 changed files with 9 additions and 8 deletions

View File

@ -976,8 +976,11 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
} else if (cmd_find_from_client(&current, item->client) == 0) { } else if (cmd_find_from_client(&current, item->client) == 0) {
fs->current = &current; fs->current = &current;
log_debug("%s: current is from client", __func__); log_debug("%s: current is from client", __func__);
} else } else {
if (~flags & CMD_FIND_QUIET)
cmdq_error(item, "no current target");
goto error; goto error;
}
if (!cmd_find_valid_state(fs->current)) if (!cmd_find_valid_state(fs->current))
fatalx("invalid current find state"); fatalx("invalid current find state");

View File

@ -159,21 +159,19 @@ cmd_string_parse(const char *s, const char *file, u_int line, char **cause)
char **argv; char **argv;
*cause = NULL; *cause = NULL;
if (cmd_string_split(s, &argc, &argv) != 0) if (cmd_string_split(s, &argc, &argv) != 0) {
goto error; xasprintf(cause, "invalid or unknown command: %s", s);
return (NULL);
}
if (argc != 0) { if (argc != 0) {
cmdlist = cmd_list_parse(argc, argv, file, line, cause); cmdlist = cmd_list_parse(argc, argv, file, line, cause);
if (cmdlist == NULL) { if (cmdlist == NULL) {
cmd_free_argv(argc, argv); cmd_free_argv(argc, argv);
goto error; return (NULL);
} }
} }
cmd_free_argv(argc, argv); cmd_free_argv(argc, argv);
return (cmdlist); return (cmdlist);
error:
xasprintf(cause, "invalid or unknown command: %s", s);
return (NULL);
} }
static void static void