[libvirt] [PATCH] Remove redundant trailing slash in user dir paths

Michal Privoznik mprivozn at redhat.com
Tue May 15 15:59:38 UTC 2012


On 15.05.2012 17:51, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> 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 at redhat.com>
> ---
>  src/util/util.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/util/util.c b/src/util/util.c
> index ec55118..ee48504 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -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;
>          }

Yeah, i've noticed it too, but you were faster.

ACK

Michal




More information about the libvir-list mailing list