qemu-img: img_create(): pass Error object to bdrv_img_create()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
71c79813d8
commit
9b37525a7d
11
qemu-img.c
11
qemu-img.c
@ -301,6 +301,7 @@ static int img_create(int argc, char **argv)
|
|||||||
const char *filename;
|
const char *filename;
|
||||||
const char *base_filename = NULL;
|
const char *base_filename = NULL;
|
||||||
char *options = NULL;
|
char *options = NULL;
|
||||||
|
Error *local_err = NULL;
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
c = getopt(argc, argv, "F:b:f:he6o:");
|
c = getopt(argc, argv, "F:b:f:he6o:");
|
||||||
@ -361,8 +362,14 @@ static int img_create(int argc, char **argv)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = bdrv_img_create(filename, fmt, base_filename, base_fmt,
|
bdrv_img_create(filename, fmt, base_filename, base_fmt,
|
||||||
options, img_size, BDRV_O_FLAGS, NULL);
|
options, img_size, BDRV_O_FLAGS, &local_err);
|
||||||
|
if (error_is_set(&local_err)) {
|
||||||
|
error_report("%s", error_get_pretty(local_err));
|
||||||
|
error_free(local_err);
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user