//go:build darwin || freebsd || linux || solaris // +build darwin freebsd linux solaris package fs import ( "fmt" "os" "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/restic" ) func (p *pathMetadataHandle) Xattr(ignoreListError bool) ([]restic.ExtendedAttribute, error) { xattrs, err := listxattr(p.name) debug.Log("fillExtendedAttributes(%v) %v %v", p.name, xattrs, err) if err != nil { if ignoreListError && isListxattrPermissionError(err) { return nil, nil } return nil, err } extendedAttrs := make([]restic.ExtendedAttribute, 0, len(xattrs)) for _, attr := range xattrs { attrVal, err := getxattr(p.name, attr) if err != nil { fmt.Fprintf(os.Stderr, "can not obtain extended attribute %v for %v:\n", attr, p.name) continue } attr := restic.ExtendedAttribute{ Name: attr, Value: attrVal, } extendedAttrs = append(extendedAttrs, attr) } return extendedAttrs, nil }