]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Remove redundant trailing slash in user dir paths
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 15 May 2012 15:49:26 +0000 (16:49 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 15 May 2012 16:07:18 +0000 (17:07 +0100)
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: Daniel P. Berrange <berrange@redhat.com>
src/util/util.c

index ec55118cddb11225d6f5b686ed77453d58b45526..ee48504b72fc70d8853d26e622d967a2fa6f59b9 100644 (file)
@@ -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;
         }