[PATCH] Move virGetUserEnt() to where its needed

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

 



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;
     }
-- 
1.8.1.5

--
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]