[PATCH 2/2] command/splash: fix return value
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Mon Jan 12 21:47:31 PST 2015
return errno when possible
otherwise return 0 for ok or 1 for error
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
commands/splash.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/commands/splash.c b/commands/splash.c
index 2ce1bdd..9bd84fb 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -11,7 +11,8 @@ static int do_splash(int argc, char *argv[])
{
struct surface s;
struct screen sc;
- int ret, opt, fd;
+ int ret = 0;
+ int opt, fd;
char *fbdev = "/dev/fb0";
char *image_file;
int offscreen = 0;
@@ -54,7 +55,7 @@ static int do_splash(int argc, char *argv[])
fd = fb_open(fbdev, &sc, offscreen);
if (fd < 0) {
perror("fd_open");
- return 1;
+ return fd;
}
if (sc.offscreenbuf) {
@@ -67,8 +68,9 @@ static int do_splash(int argc, char *argv[])
memset_pixel(&sc.info, sc.fb, bg_color, sc.s.width * sc.s.height);
}
- if (image_renderer_file(&sc, &s, image_file) < 0)
- ret = 1;
+ ret = image_renderer_file(&sc, &s, image_file);
+ if (ret > 0)
+ ret = 0;
screen_blit(&sc);
--
2.1.3
More information about the barebox
mailing list