[PATCH] bootz: give a proper error on open() failure
Sascha Hauer
s.hauer at pengutronix.de
Thu Jul 22 09:38:16 EDT 2010
Hi Baruch,
On Thu, Jul 22, 2010 at 10:30:34AM +0300, Baruch Siach wrote:
> Currently when running bootz on a nonexistent file, barebox just got stuck. Fix
> this.
Applied to -master.
Thanks
Sascha
>
> 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
>
>
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list