From a727b516ef77251f3736ed8368d9bb381664aaa5 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 18 Jul 2012 00:19:08 -0500 Subject: [PATCH] Only add / in dirtree_path if it hasn't already got one, spotted by Ashwini Sharma. --- lib/dirtree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dirtree.c b/lib/dirtree.c index 664588d..3f5a293 100644 --- a/lib/dirtree.c +++ b/lib/dirtree.c @@ -60,7 +60,7 @@ char *dirtree_path(struct dirtree *node, int *plen) len = (plen ? *plen : 0)+strlen(node->name)+1; path = dirtree_path(node->parent, &len); - if (len) path[len++]='/'; + if (len && path[len-1] != '/') path[len++]='/'; len = (stpcpy(path+len, node->name) - path); if (plen) *plen = len; -- 2.7.4