[PATCH 1/1] Cygwin: facl: fail with EBADF on files opened with O_PATH
Ken Brown
kbrown@cornell.edu
Tue Feb 23 22:49:50 GMT 2021
This is in the spirit of the Linux requirement that file operations
like fchmod(2), fchown(2), and fgetxattr(2) fail with EBADF on files
opened with O_PATH.
---
winsup/cygwin/sec_acl.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
index fe015728d..90969b639 100644
--- a/winsup/cygwin/sec_acl.cc
+++ b/winsup/cygwin/sec_acl.cc
@@ -1246,6 +1246,11 @@ facl32 (int fd, int cmd, int nentries, aclent_t *aclbufp)
syscall_printf ("-1 = facl (%d)", fd);
return -1;
}
+ if (cfd->get_flags () & O_PATH)
+ {
+ set_errno (EBADF);
+ return -1;
+ }
int res = cfd->facl (cmd, nentries, aclbufp);
syscall_printf ("%R = facl(%s) )", res, cfd->get_name ());
return res;
--
2.30.0
More information about the Cygwin-patches
mailing list