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

Ken Brown kbrown@cornell.edu
Mon Jan 20 14:57:00 GMT 2020

On 1/20/2020 4:56 AM, Corinna Vinschen wrote:
> On Jan 17 16:10, Ken Brown wrote:
>> 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(-)
> This looks good to me.  Please push.  I just wonder if this isn't
> new feature enough to bump the Cygwin version to 3.2...

Maybe.  You're in a better position to judge this than I am.  If you decide to 
do it, I'll tweak the documentation accordingly.


More information about the Cygwin-patches mailing list