Sfoglia il codice sorgente

Merge pull request #1146 from parai/patch-2

[dfs] fix the issue of stat "/.." of lwext4
Bernard Xiong 7 anni fa
parent
commit
813919b675
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7 0
      components/dfs/src/dfs.c

+ 7 - 0
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);