chunked: return PathError for fsetxattr

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2024-06-07 11:13:33 +02:00
parent 145b4f9a52
commit cdf703fa81
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772
1 changed files with 6 additions and 2 deletions

View File

@ -197,7 +197,11 @@ func setFileAttrs(dirfd int, file *os.File, mode os.FileMode, metadata *fileMeta
}
doSetXattr := func(k string, v []byte) error {
return unix.Fsetxattr(fd, k, v, 0)
err := unix.Fsetxattr(fd, k, v, 0)
if err != nil {
return &fs.PathError{Op: "fsetxattr", Path: metadata.Name, Err: err}
}
return nil
}
doUtimes := func() error {
@ -519,7 +523,7 @@ func (d whiteoutHandler) Setxattr(path, name string, value []byte) error {
defer file.Close()
if err := unix.Fsetxattr(int(file.Fd()), name, value, 0); err != nil {
return fmt.Errorf("set xattr %s=%q for %q: %w", name, value, path, err)
return &fs.PathError{Op: "fsetxattr", Path: path, Err: err}
}
return nil
}