提交 b5c5f236 编写于 作者: D Doug Goldstein

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.
上级 847e1cd1
...@@ -759,12 +759,13 @@ static char *virGetXDGDirectory(const char *xdgenvname, const char *xdgdefdir) ...@@ -759,12 +759,13 @@ static char *virGetXDGDirectory(const char *xdgenvname, const char *xdgdefdir)
{ {
const char *path = getenv(xdgenvname); const char *path = getenv(xdgenvname);
char *ret = NULL; char *ret = NULL;
char *home = virGetUserEnt(geteuid(), VIR_USER_ENT_DIRECTORY); char *home = NULL;
if (path && path[0]) { if (path && path[0]) {
if (virAsprintf(&ret, "%s/libvirt", path) < 0) if (virAsprintf(&ret, "%s/libvirt", path) < 0)
goto no_memory; goto no_memory;
} else { } else {
home = virGetUserEnt(geteuid(), VIR_USER_ENT_DIRECTORY);
if (virAsprintf(&ret, "%s/%s/libvirt", home, xdgdefdir) < 0) if (virAsprintf(&ret, "%s/%s/libvirt", home, xdgdefdir) < 0)
goto no_memory; goto no_memory;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册