qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 10/20] curl: correctly propagate errors


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH 10/20] curl: correctly propagate errors
Date: Mon, 10 Feb 2014 16:07:57 +0800
User-agent: Mutt/1.5.22 (2013-10-16)

On Sun, 02/09 10:48, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  block/curl.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/block/curl.c b/block/curl.c
> index a807584..353bab1 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -456,30 +456,27 @@ static int curl_open(BlockDriverState *bs, QDict 
> *options, int flags,
>      static int inited = 0;
>  
>      if (flags & BDRV_O_RDWR) {
> -        qerror_report(ERROR_CLASS_GENERIC_ERROR,
> -                      "curl block device does not support writes");
> +        error_setg(errp, "curl block device does not support writes");
>          return -EROFS;
>      }
>  
>      opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
>      qemu_opts_absorb_qdict(opts, options, &local_err);
>      if (error_is_set(&local_err)) {
> -        qerror_report_err(local_err);
> -        error_free(local_err);
> +        error_propagate(errp, local_err);
>          goto out_noclean;
>      }
>  
>      s->readahead_size = qemu_opt_get_size(opts, "readahead", 
> READ_AHEAD_SIZE);
>      if ((s->readahead_size & 0x1ff) != 0) {
> -        fprintf(stderr, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512\n",
> -                s->readahead_size);
> +        error_setg(errp, "HTTP_READAHEAD_SIZE %zd is not a multiple of 
> 512\n",
> +                   s->readahead_size);

Getting rid of the inconsistency of fprintf(stderr,...)'s are good!

>          goto out_noclean;
>      }
>  
>      file = qemu_opt_get(opts, "url");
>      if (file == NULL) {
> -        qerror_report(ERROR_CLASS_GENERIC_ERROR, "curl block driver requires 
> "
> -                      "an 'url' option");
> +        error_setg(errp, "curl block driver requires an 'url' option");
>          goto out_noclean;
>      }
>  
> -- 
> 1.8.5.3
> 
> 
> 

Thanks,

Reviewed-by: Fam Zheng <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]