mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: barebox@lists.infradead.org
Subject: [PATCH] bootz: give a proper error on open() failure
Date: Thu, 22 Jul 2010 10:30:34 +0300	[thread overview]
Message-ID: <663c1d5bbf018d889bd085f508d14e8e104b6430.1279783784.git.baruch@tkos.co.il> (raw)

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

             reply	other threads:[~2010-07-22  7:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22  7:30 Baruch Siach [this message]
2010-07-22 13:38 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=663c1d5bbf018d889bd085f508d14e8e104b6430.1279783784.git.baruch@tkos.co.il \
    --to=baruch@tkos.co.il \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox