comparison 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
comparison
equal deleted inserted replaced
628:3041521db5d0 629:225262d6e6c7
58 return path; 58 return path;
59 } 59 }
60 60
61 len = (plen ? *plen : 0)+strlen(node->name)+1; 61 len = (plen ? *plen : 0)+strlen(node->name)+1;
62 path = dirtree_path(node->parent, &len); 62 path = dirtree_path(node->parent, &len);
63 if (len) path[len++]='/'; 63 if (len && path[len-1] != '/') path[len++]='/';
64 len = (stpcpy(path+len, node->name) - path); 64 len = (stpcpy(path+len, node->name) - path);
65 if (plen) *plen = len; 65 if (plen) *plen = len;
66 66
67 return path; 67 return path;
68 } 68 }