summaryrefslogtreecommitdiffstats
path: root/common/parser.c
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2015-10-11 11:43:40 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2015-10-15 08:56:21 +0200
commit822ad01d5db8e530f70d76ac9da0b2730279bfb4 (patch)
tree329e7aca51294e543a1fac0dd82c5fac3bc7e846 /common/parser.c
parent69f3f7b353b645b42452b4bf7817eb4e99f13bd1 (diff)
downloadbarebox-822ad01d5db8e530f70d76ac9da0b2730279bfb4.tar.gz
common/parser.c: Do not conflate error reporting disciplines
Run_command() uses 0 to indicate success and negative values to indicate errors, whereas execute_command() uses 0 for success and positive integers to represent error codes. Conflating the two breaks the code that calls run_command and then checks for error code sign to detect problems, so avoid that by doing a very simple transformation on the result of execute_command Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/parser.c')
-rw-r--r--common/parser.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/parser.c b/common/parser.c
index ed414d0..2b95aed 100644
--- a/common/parser.c
+++ b/common/parser.c
@@ -253,7 +253,8 @@ int run_command(const char *cmd)
continue;
}
- rc = execute_command(argc, argv);
+ if (execute_command(argc, argv) != COMMAND_SUCCESS)
+ rc = -1;
}
return rc;