diff lib/dirtree.c @ 629:225262d6e6c7

Only add / in dirtree_path if it hasn't already got one, spotted by Ashwini Sharma.
author Rob Landley <rob@landley.net>
date Wed, 18 Jul 2012 00:19:08 -0500
parents 8bee9c27c219
children 786841fdb1e0
line wrap: on
line diff
--- a/lib/dirtree.c	Tue Jul 17 23:11:06 2012 -0500
+++ b/lib/dirtree.c	Wed Jul 18 00:19:08 2012 -0500
@@ -60,7 +60,7 @@
 
 	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;