aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ls.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ls.c b/src/ls.c
index 97df3c061..c0ff6e87c 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -168,11 +168,14 @@ int lsPlaylists(FILE * fp, char * utf8path) {
free(path);
if(list) {
+ int i;
sortList(list);
dup = malloc(strlen(utf8path)+2);
strcpy(dup,utf8path);
- while(dup[strlen(dup)-1]=='/') dup[strlen(dup)-1] = '\0';
+ for(i = strlen(dup)-1; i >= 0 && dup[i]=='/'; i--) {
+ dup[i] = '\0';
+ }
if(strlen(dup)) strcat(dup,"/");
node = list->firstNode;