summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/sys/unix/xattr_bsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/unix/xattr_bsd.go')
-rw-r--r--vendor/golang.org/x/sys/unix/xattr_bsd.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go
index 663b3779d..f5f8e9f36 100644
--- a/vendor/golang.org/x/sys/unix/xattr_bsd.go
+++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go
@@ -36,9 +36,14 @@ func xattrnamespace(fullattr string) (ns int, attr string, err error) {
func initxattrdest(dest []byte, idx int) (d unsafe.Pointer) {
if len(dest) > idx {
return unsafe.Pointer(&dest[idx])
- } else {
- return unsafe.Pointer(_zero)
}
+ if dest != nil {
+ // extattr_get_file and extattr_list_file treat NULL differently from
+ // a non-NULL pointer of length zero. Preserve the property of nilness,
+ // even if we can't use dest directly.
+ return unsafe.Pointer(&_zero)
+ }
+ return nil
}
// FreeBSD and NetBSD implement their own syscalls to handle extended attributes