aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2020-01-23 16:31:04 +0000
committerCorinna Vinschen <corinna@vinschen.de>2020-01-24 11:24:18 +0100
commitd880e97ec95ac3b15be972a99da2a5e97ef63ee6 (patch)
treea190c758b53eaf9f6d56147a1f4f19b2687b9c13 /winsup
parent71091d165fe62f258a6dc9c61eba9f05d04acc69 (diff)
downloadnewlib-d880e97ec95ac3b15be972a99da2a5e97ef63ee6.zip
newlib-d880e97ec95ac3b15be972a99da2a5e97ef63ee6.tar.gz
newlib-d880e97ec95ac3b15be972a99da2a5e97ef63ee6.tar.bz2
Cygwin: device_access_denied: return false if O_PATH is set
If O_PATH is set in the flags argument of fhandler_base::device_access_denied, return false. No read/write/execute access should be required in this case. Previously, the call to device_access_denied in open(2) would lead to an attempt to open the file with read access even if the O_PATH flag was set.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/fhandler.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index b0c9c50..aeee8fe 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -335,6 +335,9 @@ fhandler_base::device_access_denied (int flags)
{
int mode = 0;
+ if (flags & O_PATH)
+ return false;
+
if (flags & O_RDWR)
mode |= R_OK | W_OK;
if (flags & (O_WRONLY | O_APPEND))