diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index fe36e6d7e34..a8f1f469104 100644 --- a/fs/vfs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -258,7 +258,7 @@ static int file_vopen(FAR struct file *filep, FAR const char *path, ret = -ENXIO; } - if (ret == -EISDIR) + if (ret == -EISDIR && ((oflags & O_WRONLY) == 0)) { ret = dir_allocate(filep, desc.relpath); }