acl: define Go type alias for acl_perm_t
Define exported type alias for C.acl_perm_t and accept that for UpdatePerm. This makes representing its function signature significantly less cumbersome. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
parent
2763ec730e
commit
11832a9379
|
@ -25,7 +25,9 @@ const (
|
||||||
Other = C.ACL_OTHER
|
Other = C.ACL_OTHER
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdatePerm(path string, uid int, perms ...C.acl_perm_t) error {
|
type Perm C.acl_perm_t
|
||||||
|
|
||||||
|
func UpdatePerm(path string, uid int, perms ...Perm) error {
|
||||||
// read acl from file
|
// read acl from file
|
||||||
a, err := aclGetFile(path, TypeAccess)
|
a, err := aclGetFile(path, TypeAccess)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -55,7 +57,7 @@ func UpdatePerm(path string, uid int, perms ...C.acl_perm_t) error {
|
||||||
|
|
||||||
// add target perms
|
// add target perms
|
||||||
for _, perm := range perms {
|
for _, perm := range perms {
|
||||||
if _, err = C.acl_add_perm(p, perm); err != nil {
|
if _, err = C.acl_add_perm(p, C.acl_perm_t(perm)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue