diff options
author | Rob Landley <rob@landley.net> | 2012-07-18 00:19:08 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-07-18 00:19:08 -0500 |
commit | a727b516ef77251f3736ed8368d9bb381664aaa5 (patch) | |
tree | 7cb2f50a1d4de156aac3617320412570f7a568c4 | |
parent | 18b14e52a577754db66fe46a6ece5f2a06a7a83a (diff) | |
download | toybox-a727b516ef77251f3736ed8368d9bb381664aaa5.tar.gz |
Only add / in dirtree_path if it hasn't already got one, spotted by Ashwini Sharma.
-rw-r--r-- | lib/dirtree.c | 2 |
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; |