Commit 2a47403f authored by Jason A. Donenfeld's avatar Jason A. Donenfeld Committed by Brad Fitzpatrick

unix: always use fstatat(AT_SYMLINK_NOFOLLOW) over lstat on AMD64

ARM64 does this exact same thing, and in fact this is required on
Android 9, where Bionic now only allows lstat on 32-bit platforms
Folks are running into this when using Android on Chromebooks,
which are keeping AMD64 Android alive. So, we change the AMD64
behavior to model that of ARM64.

Change-Id: Id933cc22b42ab365c12980915557bdbf88661a4d
Reviewed-on: https://go-review.googlesource.com/c/153319
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent b0bfa5dc
......@@ -35,7 +35,11 @@ func InotifyInit() (fd int, err error) {
//sys Iopl(level int) (err error)
//sys Lchown(path string, uid int, gid int) (err error)
//sys Listen(s int, n int) (err error)
//sys Lstat(path string, stat *Stat_t) (err error)
func Lstat(path string, stat *Stat_t) (err error) {
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
}
//sys Pause() (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
......
......@@ -1862,21 +1862,6 @@ func Listen(s int, n int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lstat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pause() (err error) {
_, _, e1 := Syscall(SYS_PAUSE, 0, 0, 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