On Fri, Jul 12, 2019 at 03:36:56PM +0200, Michal Privoznik wrote:
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(a)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?
Quite easily
#define VIR_AUTOFREE(type) __attribute__((cleanup(virFree))) type
will expand correctly regardless :)
VIR_AUTOFREE(char *) userdir = NULL;
but yes that's right.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|