Re: [PATCH 39/41] remote: refactor the code for choosing the UNIX socket path

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

 



On Tue, 2019-07-23 at 17:03 +0100, Daniel P. Berrangé wrote:
[...]
> +++ b/src/remote/remote_driver.c
> @@ -739,34 +739,35 @@ remoteConnectSupportsFeatureUnlocked(virConnectPtr conn,
> +static char *
> +remoteGetUNIXSocket(remoteDriverTransport transport,
> +                    unsigned int flags)
>  {
>      char *sockname = NULL;
> -    char *userdir = virGetUserRuntimeDirectory();
> -
> -    if (!userdir)
> -        return NULL;
> +    VIR_AUTOFREE(char *userdir);

This should be

  VIR_AUTOFREE(char *) userdir = NULL;

> @@ -964,6 +965,17 @@ doRemoteOpen(virConnectPtr conn,
> +    if ((transport == REMOTE_DRIVER_TRANSPORT_UNIX ||
> +         transport == REMOTE_DRIVER_TRANSPORT_SSH ||
> +         transport == REMOTE_DRIVER_TRANSPORT_LIBSSH ||
> +         transport == REMOTE_DRIVER_TRANSPORT_LIBSSH2) &&
> +        !sockname &&
> +        !(sockname = remoteGetUNIXSocket(transport, flags)))
> +        goto failed;

The check for transport type should be implemented as a switch
statement for maximum futureproofness.


With at least the "userdir" declaration fixed,

  Reviewed-by: Andrea Bolognani <abologna@xxxxxxxxxx>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux