main: Fix parse_image_arg, check if arg is file
This commit is contained in:
1 parent
0e687beed3
commit
ab07fec919
1 file changed
+12
+12
@@ -156,6 +156,7 @@ int verbose;
|
|||||||
/* arg = [[[dev:[hw:]]ver:]type:]file[%%lay] */
|
/* arg = [[[dev:[hw:]]ver:]type:]file[%%lay] */
|
||||||
static void parse_image_arg(char * arg, struct image_list ** image_first) {
|
static void parse_image_arg(char * arg, struct image_list ** image_first) {
|
||||||
|
|
||||||
|
struct stat st;
|
||||||
struct image * image;
|
struct image * image;
|
||||||
char * file;
|
char * file;
|
||||||
char * type;
|
char * type;
|
||||||
@@ -165,6 +166,17 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
|
|||||||
char * layout;
|
char * layout;
|
||||||
char * layout_file;
|
char * layout_file;
|
||||||
|
|
||||||
|
/* Fisrt check if arg is file, then try to parse arg format */
|
||||||
|
if ( stat(arg, &st) == 0 ) {
|
||||||
|
image = image_alloc_from_file(arg, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
if ( ! image ) {
|
||||||
|
ERROR("Cannot load image file %s", file);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
image_list_add(image_first, image);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
layout_file = strchr(arg, '%');
|
layout_file = strchr(arg, '%');
|
||||||
if (layout_file)
|
if (layout_file)
|
||||||
*(layout_file++) = 0;
|
*(layout_file++) = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user