You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/10/19 13:20:43 UTC
[incubator-nuttx] 02/03: file_vopen: Retry as a directory in case of EISDIR
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 4eee9af668aedf1e647ec57de0670f88fe89f6de
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Oct 19 19:14:12 2022 +0900
file_vopen: Retry as a directory in case of EISDIR
This allows you to open() a directory without O_DIRECTORY.
---
fs/vfs/fs_open.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c
index 7b3a7544cc..b62aaf0cff 100644
--- a/fs/vfs/fs_open.c
+++ b/fs/vfs/fs_open.c
@@ -186,6 +186,11 @@ static int file_vopen(FAR struct file *filep, FAR const char *path,
ret = -ENXIO;
}
+ if (ret == -EISDIR)
+ {
+ ret = dir_allocate(filep, desc.relpath);
+ }
+
if (ret < 0)
{
goto errout_with_inode;