[newlib-cygwin] Cygwin: facl: fail with EBADF on files opened with O_PATH
Ken Brown
kbrown@sourceware.org
Wed Feb 24 13:00:38 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=117ddd9dd093aefa839899a452a4ae52cea18b4d
commit 117ddd9dd093aefa839899a452a4ae52cea18b4d
Author: Ken Brown <kbrown@cornell.edu>
Date: Tue Feb 23 17:07:00 2021 -0500
Cygwin: facl: fail with EBADF on files opened with O_PATH
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.
Diff:
---
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;
More information about the Cygwin-cvs
mailing list