示例#1
0
文件: entry.go 项目: tomdee/rkt
// Copy copies an Entry.
func (entry *Entry) Copy() (*Entry, error) {
	var cdst C.acl_entry_t
	rv, _ := C.acl_copy_entry(cdst, entry.e)
	if rv < 0 {
		return nil, fmt.Errorf("unable to copy entry")
	}
	return &Entry{cdst}, nil
}
示例#2
0
文件: acl.go 项目: naegelejd/go-acl
// AddEntry adds an Entry to the ACL.
func (acl *ACL) AddEntry(entry *Entry) error {
	newEntry, err := acl.CreateEntry()
	if err != nil {
		return err
	}
	rv, _ := C.acl_copy_entry(newEntry.e, entry.e)
	if rv < 0 {
		return fmt.Errorf("unable to copy entry while adding new entry")
	}
	return nil
}