Skip to content

Commit

Permalink
fs_open:Adjust the definition of the open path
Browse files Browse the repository at this point in the history
Summary:
  Reference https://man7.org/linux/man-pages/man2/open.2.html
       EISDIR pathname refers to a directory and the access requested
              involved writing (that is, O_WRONLY or O_RDWR is set).

Signed-off-by: chenrun1 <[email protected]>
  • Loading branch information
crafcat7 committed Oct 8, 2024
1 parent 99b364c commit 7aa3439
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/vfs/fs_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 7aa3439

Please sign in to comment.