]> xenbits.xensource.com Git - libvirt.git/commitdiff
Move virGetUserEnt() to where its needed
authorDoug Goldstein <cardoe@cardoe.com>
Sun, 16 Jun 2013 19:33:44 +0000 (14:33 -0500)
committerDoug Goldstein <cardoe@cardoe.com>
Sun, 16 Jun 2013 19:33:44 +0000 (14:33 -0500)
In the first if case, virGetUserEnt() isn't necessary so don't bother
calling it before determining we need it.

src/util/virutil.c

index c5246bcfb6d47cf0c0339572483d46d0f8641287..6fa0212e9421aebf22ecf9ad30396f7dbe4a5cb7 100644 (file)
@@ -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;
     }