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(2), "the call returns a file
descriptor referring to the symbolic link.  This file descriptor can
be used as the dirfd argument in calls to fchownat(2), fstatat(2),
linkat(2), and readlinkat(2) with an empty pathname to have the calls
operate on the symbolic link."

The second patch achieves this for readlinkat.  The third patch does
this for fstatat and fchownat by adding support for the AT_EMPTY_PATH
flag.  Nothing needs to be done for linkat, which already supports the
AT_EMPTY_PATH flag.


Ken Brown (4):
  Cygwin: allow opening a symlink with O_PATH | O_NOFOLLOW
  Cygwin: readlinkat: allow pathname to be empty
  Cygwin: fstatat, fchownat: support the AT_EMPTY_PATH flag
  Cygwin: document recent changes

 winsup/cygwin/release/3.1.3 | 19 +++++++++--
 winsup/cygwin/syscalls.cc   | 68 ++++++++++++++++++++++++++++++++-----
 winsup/doc/new-features.xml | 19 +++++++++++
 3 files changed, 94 insertions(+), 12 deletions(-)

-- 
2.21.0

Reply via email to