Update vendored library github.com/pkg/xattr

This commit is contained in:
Alexander Neumann 2018-03-30 12:38:37 +02:00
parent 19035e977b
commit 75946e7c58
9 changed files with 48 additions and 11 deletions

View file

@ -32,7 +32,9 @@ func List(path string) ([]string, error) {
return nil, &Error{"xattr.List", path, "", err}
}
if size > 0 {
buf := make([]byte, size)
// `size + 1` because of ERANGE error when reading
// from a SMB1 mount point (https://github.com/pkg/xattr/issues/16).
buf := make([]byte, size+1)
// Read into buffer of that size.
read, err := syscall.Listxattr(path, buf)
if err != nil {
@ -59,3 +61,11 @@ func Remove(path, name string) error {
}
return nil
}
// Supported checks if filesystem supports extended attributes
func Supported(path string) bool {
if _, err := syscall.Listxattr(path, nil); err != nil {
return err != syscall.ENOTSUP
}
return true
}