Skip to content

Commit 6680a6b

Browse files
committed
Merge pull request #569 from www220/fix-15-10-12-1
[DFS] 修正romfs在输入的目录名称比实际的名称短时存在的判断错误
2 parents fd53d3e + 45d46b0 commit 6680a6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/dfs/filesystems/romfs/dfs_romfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch
9696
{
9797
if (check_dirent(&dirent[index]) != 0)
9898
return RT_NULL;
99-
if (rt_strncmp(dirent[index].name, subpath, (subpath_end - subpath)) == 0)
99+
if (rt_strlen(dirent[index].name) == (subpath_end - subpath) &&
100+
rt_strncmp(dirent[index].name, subpath, (subpath_end - subpath)) == 0)
100101
{
101102
dirent_size = dirent[index].size;
102103

0 commit comments

Comments
 (0)