qemu-img: img_create(): pass Error object to bdrv_img_create()
authorLuiz Capitulino <lcapitulino@redhat.com>
Fri, 30 Nov 2012 12:52:05 +0000 (10:52 -0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 11 Dec 2012 10:05:10 +0000 (11:05 +0100)
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img.c

index 389668906079525b2c13b80cec5e3d66f60458a4..595b6f513607402278091cd31754d806d6dbccf9 100644 (file)
@@ -301,6 +301,7 @@ static int img_create(int argc, char **argv)
     const char *filename;
     const char *base_filename = NULL;
     char *options = NULL;
+    Error *local_err = NULL;
 
     for(;;) {
         c = getopt(argc, argv, "F:b:f:he6o:");
@@ -361,8 +362,14 @@ static int img_create(int argc, char **argv)
         goto out;
     }
 
-    ret = bdrv_img_create(filename, fmt, base_filename, base_fmt,
-                          options, img_size, BDRV_O_FLAGS, NULL);
+    bdrv_img_create(filename, fmt, base_filename, base_fmt,
+                    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:
     if (ret) {
         return 1;