Am 17.10.2012 21:35, schrieb Luiz Capitulino:
> Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com>
> ---
>  qemu-img.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 12fb6c2..dfde588 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -302,6 +302,7 @@ static int img_create(int argc, char **argv)
>      const char *base_filename = NULL;
>      char *options = NULL;
>      QEMUOptionParameter *params = NULL;
> +    Error *local_err = NULL;
>  
>      for(;;) {
>          c = getopt(argc, argv, "F:b:f:he6o:");
> @@ -362,9 +363,12 @@ 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, &params, NULL);
> -    if (ret < 0) {
> +    bdrv_img_create(filename, fmt, base_filename, base_fmt,
> +                    options, img_size, BDRV_O_FLAGS, &params, &local_err);
> +    if (error_is_set(&local_err)) {
> +        fprintf(stderr, "qemu-img: %s\n", error_get_pretty(local_err));

This should use error_report() instead of adding the "qemu-img:" manually.

Kevin

Reply via email to