1
0
mirror of https://github.com/gluster/glusterfs.git synced 2026-02-06 00:49:30 +01:00
Files
glusterfs/api
Anoop C S 754a8a8e8e gfapi: Fix return from glfs_open() to honour O_DIRECTORY flag
As per POSIX[1] specifications honour O_DIRECTORY flag during open as
follows:

O_DIRECTORY
    If path resolves to a non-directory file, fail and set errno to
    [ENOTDIR].

ERRORS

* [EISDIR]
  The named file is a directory and oflag includes O_WRONLY or O_RDWR,
  or includes O_CREAT without O_DIRECTORY
* [ENOTDIR]
  A component of the path prefix names an existing file that is neither
  a directory nor a symbolic link to a directory; or O_CREAT and O_EXCL
  are not specified, the path argument contains at least one non-<slash>
  character and ends with one or more trailing <slash> characters, and
  the last pathname component names an existing file that is neither a
  directory nor a symbolic link to a directory; or O_DIRECTORY was
  specified and the path argument resolves to a non-directory file.

The presence of O_DIRECTORY is to ensure the file being opened is a
directory.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2022-03-17 09:34:24 +01:00
..