You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/01/21 14:12:50 UTC
[incubator-nuttx-apps] branch master updated: examples/romfs: Add
ldir(soft link) into check
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new e4f76ac examples/romfs: Add ldir(soft link) into check
e4f76ac is described below
commit e4f76ac9eb1411ea332c06beac0a9588bb8c044a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Jan 19 04:42:45 2021 -0800
examples/romfs: Add ldir(soft link) into check
since romfs can return the soft link with the kernel change:
commit 67ef70d460db4695b950208d861ff47d4a40bdb3
Author: Xiang Xiao <xi...@xiaomi.com>
Date: Mon Jul 6 00:34:32 2020 +0800
vfs/dirread: Should return the same file type as lstat
by extend the possible value of d_type for the special file
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
examples/romfs/romfs_main.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/examples/romfs/romfs_main.c b/examples/romfs/romfs_main.c
index 80e9b11..2065538 100644
--- a/examples/romfs/romfs_main.c
+++ b/examples/romfs/romfs_main.c
@@ -153,6 +153,7 @@ static const char g_subdirfilecontent[] = "File in subdirectory\n";
static struct node_s g_adir;
static struct node_s g_afile;
+static struct node_s g_ldir;
static struct node_s g_hfile;
static struct node_s g_anotherfile;
@@ -183,7 +184,7 @@ static void connectem(void)
g_adir.size = 0;
g_adir.u.child = &g_anotherfile;
- g_afile.peer = &g_hfile;
+ g_afile.peer = &g_ldir;
g_afile.directory = false;
g_afile.found = false;
g_afile.name = "afile.txt";
@@ -191,6 +192,14 @@ static void connectem(void)
g_afile.size = strlen(g_afilecontent);
g_afile.u.filecontent = g_afilecontent;
+ g_ldir.peer = &g_hfile;
+ g_ldir.directory = true;
+ g_ldir.found = false;
+ g_ldir.name = "ldir";
+ g_ldir.mode = DIRECTORY_MODE;
+ g_ldir.size = 0;
+ g_ldir.u.child = &g_subdirfile;
+
g_hfile.peer = NULL;
g_hfile.directory = false; /* Actually a hard link */
g_hfile.found = false;
@@ -416,7 +425,7 @@ static void readdirectories(const char *path, struct node_s *entry)
printf("Continuing directory: %s\n", path);
}
}
- else
+ else if (!DIRENT_ISLINK(direntry->d_type))
{
printf(" FILE: %s/\n", fullpath);
if (node->directory)