diff options
author | Baruch Siach <baruch@tkos.co.il> | 2010-07-22 10:30:34 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-07-22 15:37:48 +0200 |
commit | 6c1c56744af22c30a622a8d97729c88e5e41c93d (patch) | |
tree | a23b652ab60a67549fdfbee26b3a4f95250c16ba /arch/arm | |
parent | cc10a6e6b4e5a9bdc0e3d0b425ee81d6e543df82 (diff) | |
download | barebox-6c1c56744af22c30a622a8d97729c88e5e41c93d.tar.gz barebox-6c1c56744af22c30a622a8d97729c88e5e41c93d.tar.xz |
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 <baruch@tkos.co.il>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/lib/armlinux.c | 5 |
1 files changed, 5 insertions, 0 deletions
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 <xfuncs.h> #include <malloc.h> #include <fcntl.h> +#include <errno.h> #include <asm/byteorder.h> #include <asm/global_data.h> @@ -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)) { |