public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: allow opening a symlink with O_PATH | O_NOFOLLOW
@ 2020-01-20 14:48 Ken Brown
  0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2020-01-20 14:48 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=35a1a6dbdf03df1e33bae51f679820a3a868d0c0

commit 35a1a6dbdf03df1e33bae51f679820a3a868d0c0
Author: Ken Brown <kbrown@cornell.edu>
Date:   Fri Dec 27 11:43:58 2019 -0500

    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.

Diff:
---
 winsup/cygwin/syscalls.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 20126ce..038a316 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-20 14:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 14:48 [newlib-cygwin] Cygwin: allow opening a symlink with O_PATH | O_NOFOLLOW Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).