From 11832a937924030699a6304a3ba9b5884532b730 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sat, 21 Sep 2024 22:25:03 +0900 Subject: [PATCH] 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 --- acl/export.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/acl/export.go b/acl/export.go index aeb8ed9..104de51 100644 --- a/acl/export.go +++ b/acl/export.go @@ -25,7 +25,9 @@ const ( 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 a, err := aclGetFile(path, TypeAccess) if err != nil { @@ -55,7 +57,7 @@ func UpdatePerm(path string, uid int, perms ...C.acl_perm_t) error { // add target 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 } }