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:
parent
cc10a6e6b4
commit
6c1c56744a
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue