4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-31 19:40:33 +08:00

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.
This commit is contained in:
Ken Brown 2021-02-23 17:07:00 -05:00
parent 949fe7bec5
commit 117ddd9dd0

View 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;