From 6c1c56744af22c30a622a8d97729c88e5e41c93d Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Thu, 22 Jul 2010 10:30:34 +0300 Subject: bootz: give a proper error on open() failure Currently when running bootz on a nonexistent file, barebox just got stuck. Fix this. Signed-off-by: Baruch Siach Signed-off-by: Sascha Hauer --- arch/arm/lib/armlinux.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c index 89d989a734..17ae057593 100644 --- a/arch/arm/lib/armlinux.c +++ b/arch/arm/lib/armlinux.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -276,6 +277,10 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[]) } fd = open(argv[1], O_RDONLY); + if (fd < 0) { + perror("open"); + return 1; + } ret = read(fd, &header, sizeof(header)); if (ret < sizeof(header)) { -- cgit v1.2.3