提交 b3567ef3 编写于 作者: D Daniel P. Berrange

Remove redundant trailing slash in user dir paths

Callers of virGetUser{Config,Runtime,Cache}Directory all
append further path component. We should not be
adding a trailing slash in the return path otherwise we
get paths containing '//'
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 54856395
......@@ -2320,10 +2320,10 @@ static char *virGetXDGDirectory(uid_t uid, const char *xdgenvname, const char *x
path = getenv(xdgenvname);
if (path && path[0]) {
if (virAsprintf(&ret, "%s/libvirt/", path) < 0)
if (virAsprintf(&ret, "%s/libvirt", path) < 0)
goto no_memory;
} else {
if (virAsprintf(&ret, "%s/%s/libvirt/", home, xdgdefdir) < 0)
if (virAsprintf(&ret, "%s/%s/libvirt", home, xdgdefdir) < 0)
goto no_memory;
}
......@@ -2357,7 +2357,7 @@ char *virGetUserRuntimeDirectory(uid_t uid)
} else {
char *ret;
if (virAsprintf(&ret, "%s/libvirt/", path) < 0) {
if (virAsprintf(&ret, "%s/libvirt", path) < 0) {
virReportOOMError();
return NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册