summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-02-26 00:24:51 +0100
committerThomas Martitz <kugel@rockbox.org>2014-02-26 00:24:51 +0100
commit6b01da8bed7f5a49f601021bdf62267ff7585c4c (patch)
tree7d40950ed8fc86209800e957efa598b34fb9bbd4
parent191bd3da9335e434bd3076160a2677f7210b9678 (diff)
downloadrockbox-6b01da8.tar.gz
rockbox-6b01da8.zip
application: fix opendir() for "/" directory.
"/" couldn't be opened. This regression was introduced by 731072d. Trailing slash should not be stripped for the root directory. Change-Id: Idd2d9b1f33e7be789bcf432e586e6715eb4152f4
-rw-r--r--firmware/common/rbpaths.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/firmware/common/rbpaths.c b/firmware/common/rbpaths.c
index 8cf92fab4a..69543bc3a7 100644
--- a/firmware/common/rbpaths.c
+++ b/firmware/common/rbpaths.c
@@ -343,7 +343,7 @@ DIR* app_opendir(const char *_name)
struct __dir *this = (struct __dir*)buf;
/* carefully remove any trailing slash from the input, so that
* hash/path matching in readdir() works properly */
- while (name[name_len-1] == '/')
+ while (name[name_len-1] == '/' && name_len > 1)
name_len -= 1;
/* strcpy cannot be used because of trailing slashes */
memcpy(this->path, name, name_len);