mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-16 18:25:08 -06:00
Move virGetUserEnt() to where its needed
In the first if case, virGetUserEnt() isn't necessary so don't bother calling it before determining we need it.
This commit is contained in:
parent
847e1cd1f8
commit
b5c5f236bb
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user