[libvirt] [PATCH 26/29] remote: refactor the code for choosing the UNIX socket path
Erik Skultety
eskultet at redhat.com
Fri Jul 12 14:07:14 UTC 2019
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 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;
syntax-check should have caught it.
Erik
More information about the libvir-list
mailing list