9
0
Fork 0

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>
This commit is contained in:
Baruch Siach 2010-07-22 10:30:34 +03:00 committed by Sascha Hauer
parent cc10a6e6b4
commit 6c1c56744a
1 changed files with 5 additions and 0 deletions

View File

@ -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)) {