diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-02-26 00:24:51 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-02-26 00:24:51 +0100 |
commit | 6b01da8bed7f5a49f601021bdf62267ff7585c4c (patch) | |
tree | 7d40950ed8fc86209800e957efa598b34fb9bbd4 | |
parent | 191bd3da9335e434bd3076160a2677f7210b9678 (diff) | |
download | rockbox-6b01da8bed7f5a49f601021bdf62267ff7585c4c.tar.gz rockbox-6b01da8bed7f5a49f601021bdf62267ff7585c4c.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.c | 2 |
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) | |||
343 | struct __dir *this = (struct __dir*)buf; | 343 | struct __dir *this = (struct __dir*)buf; |
344 | /* carefully remove any trailing slash from the input, so that | 344 | /* carefully remove any trailing slash from the input, so that |
345 | * hash/path matching in readdir() works properly */ | 345 | * hash/path matching in readdir() works properly */ |
346 | while (name[name_len-1] == '/') | 346 | while (name[name_len-1] == '/' && name_len > 1) |
347 | name_len -= 1; | 347 | name_len -= 1; |
348 | /* strcpy cannot be used because of trailing slashes */ | 348 | /* strcpy cannot be used because of trailing slashes */ |
349 | memcpy(this->path, name, name_len); | 349 | memcpy(this->path, name, name_len); |