mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] bootz: give a proper error on open() failure
@ 2010-07-22  7:30 Baruch Siach
  2010-07-22 13:38 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Baruch Siach @ 2010-07-22  7:30 UTC (permalink / raw)
  To: barebox

Currently when running bootz on a nonexistent file, barebox just got stuck. Fix
this.

Signed-off-by: Baruch Siach <baruch@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-22 13:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-22  7:30 [PATCH] bootz: give a proper error on open() failure Baruch Siach
2010-07-22 13:38 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox