[PATCH 0/3] Support opening a symlink with O_PATH | O_NOFOLLOW

Ken Brown kbrown@cornell.edu
Sat Dec 28 19:52:00 GMT 2019


Currently, opening a symlink with O_NOFOLLOW fails with ELOOP.
Following Linux, the first patch in this series allows the call to
succeed if O_PATH is also specified.

According to the Linux man page for 'open', the file descriptor
returned by the call should be usable as the dirfd argument in calls
to fchownat, fstatat, and readlinkat with an empty pathname, to have
the calls operate on the symbolic link.  The second and third patches
achieve this.  For fchownat and fstatat, we do this by adding support
for the AT_EMPTY_PATH flag.  [The man page mentions linkat also, but
it already supports the AT_EMPTY_PATH flag.]

Ken Brown (3):
  Cygwin: allow opening a symlink with O_PATH | O_NOFOLLOW
  Cygwin: readlinkat: allow pathname to be empty
  Cygwin: fchownat and fstatat: support the AT_EMPTY_PATH flag

 winsup/cygwin/syscalls.cc | 51 +++++++++++++++++++++++++++++----------
 1 file changed, 38 insertions(+), 13 deletions(-)

-- 
2.21.0



More information about the Cygwin-patches mailing list