mirror of
https://github.com/golang/go
synced 2024-11-25 01:27:56 -07:00
os: correctly handle errno==0 in (*Process).blockUntilWaitable
CL 627478 inadvertently returns a non-nil error containing a syscall.Errno(0). Change-Id: I1d6a9d0575d3ed651ddc02f30505437d0d266bb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/629515 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
a65f1a467f
commit
b8fe88393b
@ -17,7 +17,10 @@ import (
|
|||||||
func (p *Process) blockUntilWaitable() (bool, error) {
|
func (p *Process) blockUntilWaitable() (bool, error) {
|
||||||
err := ignoringEINTR(func() error {
|
err := ignoringEINTR(func() error {
|
||||||
_, errno := wait6(_P_PID, p.Pid, syscall.WEXITED|syscall.WNOWAIT)
|
_, errno := wait6(_P_PID, p.Pid, syscall.WEXITED|syscall.WNOWAIT)
|
||||||
return errno
|
if errno != 0 {
|
||||||
|
return errno
|
||||||
|
}
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
runtime.KeepAlive(p)
|
runtime.KeepAlive(p)
|
||||||
if err == syscall.ENOSYS {
|
if err == syscall.ENOSYS {
|
||||||
|
@ -29,7 +29,10 @@ func (p *Process) blockUntilWaitable() (bool, error) {
|
|||||||
psig := &siginfo[0]
|
psig := &siginfo[0]
|
||||||
err := ignoringEINTR(func() error {
|
err := ignoringEINTR(func() error {
|
||||||
_, _, errno := syscall.Syscall6(syscall.SYS_WAITID, _P_PID, uintptr(p.Pid), uintptr(unsafe.Pointer(psig)), syscall.WEXITED|syscall.WNOWAIT, 0, 0)
|
_, _, errno := syscall.Syscall6(syscall.SYS_WAITID, _P_PID, uintptr(p.Pid), uintptr(unsafe.Pointer(psig)), syscall.WEXITED|syscall.WNOWAIT, 0, 0)
|
||||||
return errno
|
if errno != 0 {
|
||||||
|
return errno
|
||||||
|
}
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
runtime.KeepAlive(p)
|
runtime.KeepAlive(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user