public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: facl: fail with EBADF on files opened with O_PATH
@ 2021-02-24 13:00 Ken Brown
  0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2021-02-24 13:00 UTC (permalink / raw)
  To: cygwin-cvs

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;


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

only message in thread, other threads:[~2021-02-24 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 13:00 [newlib-cygwin] Cygwin: facl: fail with EBADF on files opened with O_PATH 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).