From 6b01da8bed7f5a49f601021bdf62267ff7585c4c Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 26 Feb 2014 00:24:51 +0100 Subject: 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 --- firmware/common/rbpaths.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3