summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2015-10-14 10:32:54 +0800
committerBernard Xiong <[email protected]>2015-10-14 10:32:54 +0800
commit6680a6b57ffada87ddd5756fb2228e6afc176a96 (patch)
tree3a943b62e7068621d90a82571016c009a29f7def
parentfd53d3ec2855e7a3f9592774378d78083a5a0939 (diff)
parent45d46b076fcb8d9c85ac31edac1120c01a43930b (diff)
Merge pull request #569 from www220/fix-15-10-12-1
[DFS] 修正romfs在输入的目录名称比实际的名称短时存在的判断错误
-rw-r--r--components/dfs/filesystems/romfs/dfs_romfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/dfs/filesystems/romfs/dfs_romfs.c b/components/dfs/filesystems/romfs/dfs_romfs.c
index 1dd41b41eb..6110d61227 100644
--- a/components/dfs/filesystems/romfs/dfs_romfs.c
+++ b/components/dfs/filesystems/romfs/dfs_romfs.c
@@ -96,7 +96,8 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch
{
if (check_dirent(&dirent[index]) != 0)
return RT_NULL;
- if (rt_strncmp(dirent[index].name, subpath, (subpath_end - subpath)) == 0)
+ if (rt_strlen(dirent[index].name) == (subpath_end - subpath) &&
+ rt_strncmp(dirent[index].name, subpath, (subpath_end - subpath)) == 0)
{
dirent_size = dirent[index].size;