Cygwin: allow opening a symlink with O_PATH | O_NOFOLLOW

Up to now, opening a symlink with O_NOFOLLOW fails with ELOOP.
Following Linux, allow this to succeed if O_PATH is also specified.
This commit is contained in:
Ken Brown 2019-12-27 11:43:58 -05:00
parent 85aff2830a
commit 35a1a6dbdf
1 changed files with 1 additions and 1 deletions

View File

@ -1470,7 +1470,7 @@ open (const char *unix_path, int flags, ...)
if (!(fh = build_fh_name (unix_path, opt, stat_suffixes)))
__leave; /* errno already set */
if ((flags & O_NOFOLLOW) && fh->issymlink ())
if ((flags & O_NOFOLLOW) && fh->issymlink () && !(flags & O_PATH))
{
set_errno (ELOOP);
__leave;