summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2019-12-12 20:34:17 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-12-13 09:27:25 +0100
commit7caa298e4dc5af198b32fe10d37864a098008110 (patch)
treea9209f824d633971bb1151e5cd301c01de6656a0 /commands
parent8cd3e5007c88317735332c1a78251bf7c22d4888 (diff)
downloadbarebox-7caa298e4dc5af198b32fe10d37864a098008110.tar.gz
barebox-7caa298e4dc5af198b32fe10d37864a098008110.tar.xz
commands: led: print actual error code when led_set fails
If led_set fails, the error code is the return value, not errno. Fix this. While at replace the magic value in the command return code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/led.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/commands/led.c b/commands/led.c
index a53f0df6a2..b608fcfa2c 100644
--- a/commands/led.c
+++ b/commands/led.c
@@ -101,8 +101,8 @@ static int do_led(int argc, char *argv[])
ret = led_set(led, value);
if (ret < 0) {
- perror("led");
- return 1;
+ printf("led: %s\n", strerror(-ret));
+ return COMMAND_ERROR;
}
return 0;