|
@@ -1,8 +1,6 @@
|
|
package system // import "github.com/docker/docker/pkg/system"
|
|
package system // import "github.com/docker/docker/pkg/system"
|
|
|
|
|
|
import (
|
|
import (
|
|
- "io/fs"
|
|
|
|
-
|
|
|
|
"golang.org/x/sys/unix"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -10,8 +8,8 @@ import (
|
|
// and associated with the given path in the file system.
|
|
// and associated with the given path in the file system.
|
|
// It will returns a nil slice and nil error if the xattr is not set.
|
|
// It will returns a nil slice and nil error if the xattr is not set.
|
|
func Lgetxattr(path string, attr string) ([]byte, error) {
|
|
func Lgetxattr(path string, attr string) ([]byte, error) {
|
|
- pathErr := func(err error) ([]byte, error) {
|
|
|
|
- return nil, &fs.PathError{Op: "lgetxattr", Path: path, Err: err}
|
|
|
|
|
|
+ sysErr := func(err error) ([]byte, error) {
|
|
|
|
+ return nil, &XattrError{Op: "lgetxattr", Attr: attr, Path: path, Err: err}
|
|
}
|
|
}
|
|
|
|
|
|
// Start with a 128 length byte array
|
|
// Start with a 128 length byte array
|
|
@@ -22,7 +20,7 @@ func Lgetxattr(path string, attr string) ([]byte, error) {
|
|
// Buffer too small, use zero-sized buffer to get the actual size
|
|
// Buffer too small, use zero-sized buffer to get the actual size
|
|
sz, errno = unix.Lgetxattr(path, attr, []byte{})
|
|
sz, errno = unix.Lgetxattr(path, attr, []byte{})
|
|
if errno != nil {
|
|
if errno != nil {
|
|
- return pathErr(errno)
|
|
|
|
|
|
+ return sysErr(errno)
|
|
}
|
|
}
|
|
dest = make([]byte, sz)
|
|
dest = make([]byte, sz)
|
|
sz, errno = unix.Lgetxattr(path, attr, dest)
|
|
sz, errno = unix.Lgetxattr(path, attr, dest)
|
|
@@ -32,7 +30,7 @@ func Lgetxattr(path string, attr string) ([]byte, error) {
|
|
case errno == unix.ENODATA:
|
|
case errno == unix.ENODATA:
|
|
return nil, nil
|
|
return nil, nil
|
|
case errno != nil:
|
|
case errno != nil:
|
|
- return pathErr(errno)
|
|
|
|
|
|
+ return sysErr(errno)
|
|
}
|
|
}
|
|
|
|
|
|
return dest[:sz], nil
|
|
return dest[:sz], nil
|
|
@@ -43,7 +41,7 @@ func Lgetxattr(path string, attr string) ([]byte, error) {
|
|
func Lsetxattr(path string, attr string, data []byte, flags int) error {
|
|
func Lsetxattr(path string, attr string, data []byte, flags int) error {
|
|
err := unix.Lsetxattr(path, attr, data, flags)
|
|
err := unix.Lsetxattr(path, attr, data, flags)
|
|
if err != nil {
|
|
if err != nil {
|
|
- return &fs.PathError{Op: "lsetxattr", Path: path, Err: err}
|
|
|
|
|
|
+ return &XattrError{Op: "lsetxattr", Attr: attr, Path: path, Err: err}
|
|
}
|
|
}
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|