瀏覽代碼

Filtration . Catalogue and .. Catalogue

tangyuxin 6 年之前
父節點
當前提交
e0fdfcdda4
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      dfs_lfs.c

+ 9 - 0
dfs_lfs.c

@@ -778,6 +778,15 @@ static int _dfs_lfs_getdents(struct dfs_fd* file, struct dirent* dirp, uint32_t
             break;
         }
 
+        if (rt_strcmp(info.name, ".") == 0)
+        {
+            continue;
+        }
+        else if (rt_strcmp(info.name, "..") == 0)
+        {
+            continue;
+        }
+
         d->d_type = DT_UNKNOWN;
 
         switch (info.type)