mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 20:39:33 +08:00
* fhandler_disk_file.cc (fhandler_disk_file::facl): Pretend successful
SETACL if no acls are available. * fhandler.cc (fhandler_base::facl): Implement to return sensible values on GETACL and GETACLCNT. Pretend successful SETACL. * fhandler_virtual.cc (fhandler_virtual::facl): Ditto.
This commit is contained in:
parent
36ca239fd4
commit
aafdf30f7a
@ -1,3 +1,11 @@
|
||||
2005-01-14 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler_disk_file.cc (fhandler_disk_file::facl): Pretend successful
|
||||
SETACL if no acls are available.
|
||||
* fhandler.cc (fhandler_base::facl): Implement to return sensible
|
||||
values on GETACL and GETACLCNT. Pretend successful SETACL.
|
||||
* fhandler_virtual.cc (fhandler_virtual::facl): Ditto.
|
||||
|
||||
2005-01-13 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler.h (fhandler_disk_file::touch_ctime): Declare.
|
||||
|
@ -1539,6 +1539,41 @@ fhandler_base::fchown (__uid32_t uid, __gid32_t gid)
|
||||
int
|
||||
fhandler_base::facl (int cmd, int nentries, __aclent32_t *aclbufp)
|
||||
{
|
||||
int res = -1;
|
||||
switch (cmd)
|
||||
{
|
||||
case SETACL:
|
||||
/* By default, just succeeds. */
|
||||
return 0;
|
||||
res = 0;
|
||||
break;
|
||||
case GETACL:
|
||||
if (!aclbufp)
|
||||
set_errno(EFAULT);
|
||||
else if (nentries < MIN_ACL_ENTRIES)
|
||||
set_errno (ENOSPC);
|
||||
else
|
||||
{
|
||||
aclbufp[0].a_type = USER_OBJ;
|
||||
aclbufp[0].a_id = myself->uid;
|
||||
aclbufp[0].a_perm = (S_IRUSR | S_IWUSR) >> 6;
|
||||
aclbufp[1].a_type = GROUP_OBJ;
|
||||
aclbufp[1].a_id = myself->gid;
|
||||
aclbufp[1].a_perm = (S_IRGRP | S_IWGRP) >> 3;
|
||||
aclbufp[2].a_type = OTHER_OBJ;
|
||||
aclbufp[2].a_id = ILLEGAL_GID;
|
||||
aclbufp[2].a_perm = S_IROTH | S_IWOTH;
|
||||
aclbufp[3].a_type = CLASS_OBJ;
|
||||
aclbufp[3].a_id = ILLEGAL_GID;
|
||||
aclbufp[3].a_perm = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||
res = MIN_ACL_ENTRIES;
|
||||
}
|
||||
break;
|
||||
case GETACLCNT:
|
||||
res = MIN_ACL_ENTRIES;
|
||||
break;
|
||||
default:
|
||||
set_errno (EINVAL);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -498,7 +498,11 @@ fhandler_disk_file::facl (int cmd, int nentries, __aclent32_t *aclbufp)
|
||||
struct __stat64 st;
|
||||
|
||||
case SETACL:
|
||||
set_errno (ENOSYS);
|
||||
/* Open for writing required to be able to set ctime
|
||||
(even though setting the ACL is just pretended). */
|
||||
if (!get_io_handle ())
|
||||
oret = open_fs (O_WRONLY | O_BINARY, 0);
|
||||
res = 0;
|
||||
break;
|
||||
case GETACL:
|
||||
if (!aclbufp)
|
||||
|
@ -247,7 +247,12 @@ fhandler_virtual::fchown (__uid32_t uid, __gid32_t gid)
|
||||
int
|
||||
fhandler_virtual::facl (int cmd, int nentries, __aclent32_t *aclbufp)
|
||||
{
|
||||
/* Same as on Linux. */
|
||||
set_errno (EPERM);
|
||||
return -1;
|
||||
int res = fhandler_base::facl (cmd, nentries, aclbufp);
|
||||
if (res >= 0 && cmd == GETACL)
|
||||
{
|
||||
aclbufp[0].a_perm = (S_IRUSR | (pc.isdir () ? S_IXUSR : 0)) >> 6;
|
||||
aclbufp[1].a_perm = (S_IRGRP | (pc.isdir () ? S_IXGRP : 0)) >> 3;
|
||||
aclbufp[2].a_perm = S_IROTH | (pc.isdir () ? S_IXOTH : 0);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user