aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/acl/acl.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/acl/acl.go')
-rw-r--r--internal/acl/acl.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/internal/acl/acl.go b/internal/acl/acl.go
index 7718ba3c..8b862ba2 100644
--- a/internal/acl/acl.go
+++ b/internal/acl/acl.go
@@ -7,7 +7,12 @@ package acl
#include "libacl-helper.h"
*/
import "C"
-import "os"
+
+import (
+ "os"
+
+ "hakurei.app/container"
+)
// Perm represents acl_perm_t.
type Perm C.acl_perm_t
@@ -83,11 +88,21 @@ func (e Error) Error() string {
// Update replaces ACL_USER entry with qualifier uid.
func Update(name string, uid int, perms Perm) error {
+ f, _err := os.OpenFile(name, container.O_PATH, 0)
+ if _err != nil {
+ return _err
+ }
+
r, err := C.hakurei_update_acl(
- C.CString(name),
+ C.int(f.Fd()),
C.uid_t(uid),
C.acl_perm_t(perms),
)
+
+ if _err = f.Close(); _err != nil {
+ return _err
+ }
+
if r == C.HAKUREI_ACL_OK {
return nil
}