Commit 58da1121 authored by Dave Cheney's avatar Dave Cheney

unix: use fchownat(2) in place of lchown(2) for linux/arm64

Updates #11918

Replace calls to lchown(2) with fchownat(2) for linux/arm64 as the former
is not suppored.

This is a companion to CL 12833 which is ready to be applied to the main
repo, and verified by CL 12834 which can be applied once this change and
CL 12833 have landed.

Change-Id: I63de3d0da1e4b4e1f253e51e0ed8e0cd0e56d63a
Reviewed-on: https://go-review.googlesource.com/12837Reviewed-by: 's avatarRob Pike <r@golang.org>
parent 3826714b
......@@ -18,7 +18,6 @@ const _SYS_dup = SYS_DUP3
//sysnb Getgid() (gid int)
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Getuid() (uid int)
//sys Lchown(path string, uid int, gid int) (err error)
//sys Listen(s int, n int) (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
......@@ -39,6 +38,10 @@ func Stat(path string, stat *Stat_t) (err error) {
return Fstatat(AT_FDCWD, path, stat, 0)
}
func Lchown(path string, uid int, gid int) (err error) {
return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW)
}
func Lstat(path string, stat *Stat_t) (err error) {
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
}
......
......@@ -1310,22 +1310,6 @@ func Getuid() (uid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lchown(path string, uid int, gid int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Listen(s int, n int) (err error) {
_, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0)
if e1 != 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment