syscall: use fchownat(2) in place of lchown(2) for linux/arm64
Fixes #11918 Replace calls to lchown(2) with fchownat(2) for linux/arm64 as the former is not suppored. This change has also landed on the x/sys repo as CL 12837. Change-Id: I58d4b144e051e36dd650ec9b7f3a02610ea943e5 Reviewed-on: https://go-review.googlesource.com/12833 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net> Run-TryBot: Dave Cheney <dave@cheney.net> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
a5d23fceab
commit
4e15092006
@ -16,7 +16,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
|
||||
@ -37,6 +36,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)
|
||||
}
|
||||
|
@ -1295,22 +1295,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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user