[libvirt] [PATCH 26/29] remote: refactor the code for choosing the UNIX socket path

Michal Privoznik mprivozn at redhat.com
Fri Jul 12 13:36:56 UTC 2019


On 7/11/19 6:05 PM, Daniel P. Berrangé wrote:
> The ssh, libssh, libssh2 & unix transports all need to use a UNIX socket
> path, and duplicate some of the same logic for error checking. Pull this
> out into a separate method to increase code sharing.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>   src/remote/remote_driver.c | 111 ++++++++++++-------------------------
>   1 file changed, 36 insertions(+), 75 deletions(-)
> 
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 87c184720c..c6905dffff 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -739,34 +739,35 @@ remoteConnectSupportsFeatureUnlocked(virConnectPtr conn,
>       }
>   
>   
> -#ifndef WIN32
> -static char *remoteGetUNIXSocketNonRoot(void)
> +static char *
> +remoteGetUNIXSocket(remoteDriverTransport transport,
> +                    unsigned int flags)
>   {
>       char *sockname = NULL;
> -    char *userdir = virGetUserRuntimeDirectory();
> -
> -    if (!userdir)
> -        return NULL;
> +    VIR_AUTOFREE(char *userdir);

Ouch, how does this even compile?

VIR_AUTOFREE(char *) userdir = NULL;


Michal




More information about the libvir-list mailing list