chore:reva bump v.2.33.1 (#1027)
This commit is contained in:
+13
-6
@@ -4,8 +4,8 @@
|
||||
package xattr
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
@@ -17,10 +17,11 @@ const (
|
||||
XATTR_CREATE = 0x1
|
||||
XATTR_REPLACE = 0x2
|
||||
|
||||
// ENOATTR is not exported by the syscall package on Linux, because it is
|
||||
// an alias for ENODATA. We export it here so it is available on all
|
||||
// our supported platforms.
|
||||
ENOATTR = syscall.ENODATA
|
||||
// ENOATTR is not defined on Solaris. When attempting to open an
|
||||
// extended attribute that doesn't exist, we'll get ENOENT. For
|
||||
// compatibility with other platforms, we make ENOATTR available as
|
||||
// an alias of unix.ENOENT.
|
||||
ENOATTR = unix.ENOENT
|
||||
)
|
||||
|
||||
func getxattr(path string, name string, data []byte) (int, error) {
|
||||
@@ -132,7 +133,13 @@ func llistxattr(path string, data []byte) (int, error) {
|
||||
func flistxattr(f *os.File, data []byte) (int, error) {
|
||||
fd, err := unix.Openat(int(f.Fd()), ".", unix.O_RDONLY|unix.O_XATTR, 0)
|
||||
if err != nil {
|
||||
return 0, unix.ENOTSUP
|
||||
// When attempting to list extended attributes on a filesystem
|
||||
// that doesn't support them (like as UFS and tmpfs), we'll get
|
||||
// EINVAL. Translate this error to the more conventional ENOTSUP.
|
||||
if errors.Is(err, unix.EINVAL) {
|
||||
return 0, unix.ENOTSUP
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
xf := os.NewFile(uintptr(fd), f.Name())
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user