qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 3/3] block/nfs: switch to error_init_local


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 3/3] block/nfs: switch to error_init_local
Date: Wed, 17 Jun 2015 09:32:09 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 06/17/2015 01:24 AM, Michael S. Tsirkin wrote:
> We probably should just switch everyone, this is
> just to demonstrate the API usage.
> 
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
>  block/nfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/nfs.c b/block/nfs.c
> index ca9e24e..de4b8c3 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -385,7 +385,7 @@ static int nfs_file_open(BlockDriverState *bs, QDict 
> *options, int flags,
>      NFSClient *client = bs->opaque;
>      int64_t ret;
>      QemuOpts *opts;
> -    Error *local_err = NULL;
> +    Error *local_err = error_init_local(errp);
>  
>      client->aio_context = bdrv_get_aio_context(bs);

More context:

>     opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
>     qemu_opts_absorb_qdict(opts, options, &local_err);
>     if (local_err) {
>         error_propagate(errp, local_err);
>         ret = -EINVAL;

Oops.  Your initialization means that if the caller passed in
&error_abort, then local_err is now non-NULL, and we will attempt to do
error_propagate(errp, error_abort), which will abort().  You'd have to
change that to
   if (!error_is_abort(local_err)) {

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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