From eade1bbd0f0eed96743b5b75c4c7b3ff09521ff5 Mon Sep 17 00:00:00 2001 From: parai Date: Thu, 28 Dec 2017 13:36:33 +0800 Subject: [PATCH] [dfs] fix the issue of stat "/.." of lwext4 --- components/dfs/src/dfs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index 51aa77748..858399fd1 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -404,6 +404,13 @@ up_one: if ((dst != fullpath) && (*dst == '/')) *dst = '\0'; + /* final check fullpath is not empty, for the special path of lwext "/.." */ + if ('\0' == fullpath[0]) + { + fullpath[0] = '/'; + fullpath[1] = '\0'; + } + return fullpath; } RTM_EXPORT(dfs_normalize_path);