[libvirt] [PATCH] Move virGetUserEnt() to where its needed
Michal Privoznik
mprivozn at redhat.com
Mon Jun 17 12:04:32 UTC 2013
On 16.06.2013 23:45, Doug Goldstein wrote:
> In the first if case, virGetUserEnt() isn't necessary so don't bother
> calling it before determining we need it.
> ---
> Found this trying to get libvirtd running happily on my Mac OS X machine
> for qemu. Unfortunately it appears virGetUserEnt() is always failing
> on Mac OS X (getpwuid_r() returns 0 each time) because we are requesting
> info on a different high value UIDs each time (32xxx). That's another
> issue entirely but this fix allows me to ignore that and test other
> fixes on my Mac.
> ---
> src/util/virutil.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/util/virutil.c b/src/util/virutil.c
> index c5246bc..6fa0212e 100644
> --- a/src/util/virutil.c
> +++ b/src/util/virutil.c
> @@ -759,12 +759,13 @@ static char *virGetXDGDirectory(const char *xdgenvname, const char *xdgdefdir)
> {
> const char *path = getenv(xdgenvname);
> char *ret = NULL;
> - char *home = virGetUserEnt(geteuid(), VIR_USER_ENT_DIRECTORY);
> + char *home = NULL;
>
> if (path && path[0]) {
> if (virAsprintf(&ret, "%s/libvirt", path) < 0)
> goto no_memory;
> } else {
> + home = virGetUserEnt(geteuid(), VIR_USER_ENT_DIRECTORY);
> if (virAsprintf(&ret, "%s/%s/libvirt", home, xdgdefdir) < 0)
> goto no_memory;
> }
>
ACK
Michal
More information about the libvir-list
mailing list