Skip to content

Commit

Permalink
hush: make run_command() return an error on parsing failure
Browse files Browse the repository at this point in the history
run_command() returns success even if the command had a syntax error;
correct this behaviour.

Signed-off-by: Rabin Vincent <[email protected]>
Acked-by: Simon Glass <[email protected])
  • Loading branch information
vitkyrka authored and trini committed Nov 7, 2014
1 parent 128059b commit 2302b3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/cli_hush.c
Original file line number Diff line number Diff line change
Expand Up @@ -3162,7 +3162,7 @@ static int parse_stream_outer(struct in_str *inp, int flag)
o_string temp=NULL_O_STRING;
int rcode;
#ifdef __U_BOOT__
int code = 0;
int code = 1;
#endif
do {
ctx.type = flag;
Expand Down
2 changes: 2 additions & 0 deletions test/command_ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
assert(run_command("", 0) == 0);
assert(run_command(" ", 0) == 0);

assert(run_command("'", 0) == 1);

printf("%s: Everything went swimmingly\n", __func__);
return 0;
}
Expand Down

0 comments on commit 2302b3a

Please sign in to comment.