aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-07-18 00:19:08 -0500
committerRob Landley <rob@landley.net>2012-07-18 00:19:08 -0500
commita727b516ef77251f3736ed8368d9bb381664aaa5 (patch)
tree7cb2f50a1d4de156aac3617320412570f7a568c4 /lib
parent18b14e52a577754db66fe46a6ece5f2a06a7a83a (diff)
downloadtoybox-a727b516ef77251f3736ed8368d9bb381664aaa5.tar.gz
Only add / in dirtree_path if it hasn't already got one, spotted by Ashwini Sharma.
Diffstat (limited to 'lib')
-rw-r--r--lib/dirtree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/dirtree.c b/lib/dirtree.c
index 664588d8..3f5a2935 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;