From 45d46b076fcb8d9c85ac31edac1120c01a43930b Mon Sep 17 00:00:00 2001 From: "www220@tom.com" Date: Wed, 14 Oct 2015 10:28:25 +0800 Subject: 修正romfs在输入的目录名称比实际的名称短时存在的判断错误 比如实际目录为abcde,msh执行 cd abc也能执行成功,判断名称时存在bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/filesystems/romfs/dfs_romfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- cgit v1.3.1