summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2014-09-01 00:00:19 -0400
committerMichael Sevakis <jethead71@rockbox.org>2014-09-01 00:00:19 -0400
commit802e0110db79473861b2859a5c1c7cc3764d9e5f (patch)
treeb1488100f2628f8d1a74d3bc83ea018b1071bae9
parent5b08f1a5b99136ef052b6f430b62bc618cd44946 (diff)
downloadrockbox-802e011.tar.gz
rockbox-802e011.zip
Fix a small late creep-in goof in path parsing on native targets
Anything of one dot and one character (e.g. ".a") would get treated as "." because I left out a condition when converting to recursionless parsing of relative components. Git 'er fixed up. Change-Id: Id5603ce0858b419dc08b1d496b4b187a573595f9
-rw-r--r--firmware/common/file_internal.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/firmware/common/file_internal.c b/firmware/common/file_internal.c
index e5b43cd19d..b66aafd61e 100644
--- a/firmware/common/file_internal.c
+++ b/firmware/common/file_internal.c
@@ -505,8 +505,12 @@ walk_path(struct pathwalk *walkp, struct pathwalk_component *compp,
/* check for "." and ".." */
if (name[0] == '.')
{
- if (len == 2 && name[1] == '.')
+ if (len == 1)
+ break; /* is "." */
+
+ if (name[1] == '.')
{
+ /* is ".." */
struct pathwalk_component *parentp = compp->nextp;
if (!parentp)
return WALK_RC_CONT_AT_ROOT;
@@ -514,9 +518,8 @@ walk_path(struct pathwalk *walkp, struct pathwalk_component *compp,
compp->nextp = freep;
freep = compp;
compp = parentp;
+ break;
}
-
- break;
}
/* fallthrough */