diff options
| author | [email protected] <[email protected]> | 2015-10-14 10:28:25 +0800 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2015-10-14 10:28:25 +0800 |
| commit | 45d46b076fcb8d9c85ac31edac1120c01a43930b (patch) | |
| tree | 78a2c38ce9e7c0e512dd63881185b21f482efcab | |
| parent | c7af45b7593f8e1b54e963b65888e0db8a894b0e (diff) | |
修正romfs在输入的目录名称比实际的名称短时存在的判断错误
比如实际目录为abcde,msh执行 cd abc也能执行成功,判断名称时存在bug
| -rw-r--r-- | components/dfs/filesystems/romfs/dfs_romfs.c | 3 |
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; |
