Skip to content

Commit

Permalink
common/parser.c: Do not treat zero return code as error
Browse files Browse the repository at this point in the history
Run_command() would return zero to indicated success so treating it as
error case would completely break command repetition logic, so change
comparinson operator from "less or equal" to "less then"

Signed-off-by: Andrey Smirnov <[email protected]>
Signed-off-by: Sascha Hauer <[email protected]>
  • Loading branch information
ndreys authored and saschahauer committed Oct 15, 2015
1 parent 822ad01 commit 04d8c25
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions common/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ int run_shell(void)
{
static char lastcommand[CONFIG_CBSIZE] = { 0, };
int len;
int rc = 1;

login();

Expand All @@ -276,14 +275,14 @@ int run_shell(void)
if (len > 0)
strcpy (lastcommand, console_buffer);

if (len == -1)
if (len == -1) {
puts ("<INTERRUPT>\n");
else
rc = run_command(lastcommand);

if (rc <= 0) {
/* invalid command or not repeatable, forget it */
lastcommand[0] = 0;
} else {
const int rc = run_command(lastcommand);
if (rc < 0) {
/* invalid command or not repeatable, forget it */
lastcommand[0] = 0;
}
}
}
return 0;
Expand Down

0 comments on commit 04d8c25

Please sign in to comment.