[PATCH] bootz: give a proper error on open() failure
Baruch Siach
baruch at tkos.co.il
Thu Jul 22 03:30:34 EDT 2010
Currently when running bootz on a nonexistent file, barebox just got stuck. Fix
this.
Signed-off-by: Baruch Siach <baruch at tkos.co.il>
---
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 89d989a..17ae057 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)) {
--
1.7.1
More information about the barebox
mailing list