Patchwork [3/6] qemu-img: img_create(): pass Error object to bdrv_img_create()

login
register
mail settings
Submitter Luiz Capitulino
Date Oct. 19, 2012, 2:28 p.m.
Message ID <1350656885-6485-4-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/192722/
State New
Headers show

Comments

Luiz Capitulino - Oct. 19, 2012, 2:28 p.m.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qemu-img.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Patch

diff --git a/qemu-img.c b/qemu-img.c
index b841012..a5f2969 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -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;