From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2210) id 45503385482D; Wed, 24 Feb 2021 13:00:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45503385482D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ken Brown To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: facl: fail with EBADF on files opened with O_PATH X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: 949fe7bec564f91818bad801bda47a4ddd58fadf X-Git-Newrev: 117ddd9dd093aefa839899a452a4ae52cea18b4d Message-Id: <20210224130038.45503385482D@sourceware.org> Date: Wed, 24 Feb 2021 13:00:38 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2021 13:00:38 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=117ddd9dd093aefa839899a452a4ae52cea18b4d commit 117ddd9dd093aefa839899a452a4ae52cea18b4d Author: Ken Brown 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;