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

Re: [libvirt] [PATCH 02/19] Set conn->driver before running driver connectOpen method



On 19.06.2013 19:00, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> The access control checks in the 'connectOpen' driver method
> will require 'conn->driver' to be non-NULL. Set this before
> running the 'connectOpen' method and NULL-ify it again on
> failure.
> 
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  src/libvirt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libvirt.c b/src/libvirt.c
> index b467679..8e8f415 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -1201,6 +1201,7 @@ do_open(const char *name,
>          }
>  
>          VIR_DEBUG("trying driver %d (%s) ...", i, virDriverTab[i]->name);
> +        ret->driver = virDriverTab[i];
>          res = virDriverTab[i]->connectOpen(ret, auth, flags);
>          VIR_DEBUG("driver %d %s returned %s",
>                    i, virDriverTab[i]->name,
> @@ -1209,10 +1210,12 @@ do_open(const char *name,
>                    (res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
>  
>          if (res == VIR_DRV_OPEN_SUCCESS) {
> -            ret->driver = virDriverTab[i];
>              break;
>          } else if (res == VIR_DRV_OPEN_ERROR) {
> +            ret->driver = NULL;
>              goto failed;
> +        } else {
> +            ret->driver = NULL;

or:

} else {
  ret->driver = NULL;
  if (res == VIR_DRV_OPEN_ERROR)
    goto failed;
}

But I can live with both.
>          }
>      }
>  
> 

Michal


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