From 570f16fd6d736b6927cc4b007767e0cba908baf2 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Tue, 8 Apr 2003 02:05:14 +0000 Subject: [PATCH] Improved responsiveness for dirplay, plus fixed a bug that could cause a file handle leak, and sometimes playlist loading problems git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3518 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/playlist.c b/apps/playlist.c index 058dcfe88c..165c13847b 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -490,18 +490,21 @@ char* playlist_peek(int steps) /* remove bogus dirs from beginning of path (workaround for buggy playlist creation tools) */ - while (buf) + if(!playlist.in_ram) { - fd = open(buf, O_RDONLY); - if (fd > 0) + while (buf) { - close(fd); - break; + fd = open(buf, O_RDONLY); + if (fd >= 0) + { + close(fd); + break; + } + + buf = strchr(buf+1, '/'); } - - buf = strchr(buf+1, '/'); } - + if (!buf) { /* Even though this is an invalid file, we still need to pass a file