]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: facl: fail with EBADF on files opened with O_PATH
authorKen Brown <kbrown@cornell.edu>
Tue, 23 Feb 2021 22:07:00 +0000 (17:07 -0500)
committerKen Brown <kbrown@cornell.edu>
Wed, 24 Feb 2021 12:59:41 +0000 (07:59 -0500)
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

index fe015728d72d16bb9344bfd7b97ec6206e40ea70..90969b639df2a4ac07b2382acd276735c33a6e48 100644 (file)
@@ -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;
This page took 0.039631 seconds and 5 git commands to generate.