From: Damien Neil Date: Mon, 18 Nov 2024 22:39:20 +0000 (-0800) Subject: os: correctly handle errno==0 in (*Process).blockUntilWaitable X-Git-Tag: go1.24rc1~305 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b8fe88393b122a06e00163dc464bf8cd14187f4b;p=gostls13.git 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Commit-Queue: Ian Lance Taylor --- diff --git a/src/os/wait_wait6.go b/src/os/wait_wait6.go index 00848bfdc2..113535e5bd 100644 --- a/src/os/wait_wait6.go +++ b/src/os/wait_wait6.go @@ -17,7 +17,10 @@ import ( func (p *Process) blockUntilWaitable() (bool, error) { err := ignoringEINTR(func() error { _, errno := wait6(_P_PID, p.Pid, syscall.WEXITED|syscall.WNOWAIT) - return errno + if errno != 0 { + return errno + } + return nil }) runtime.KeepAlive(p) if err == syscall.ENOSYS { diff --git a/src/os/wait_waitid.go b/src/os/wait_waitid.go index 73012404eb..f2447a0e4c 100644 --- a/src/os/wait_waitid.go +++ b/src/os/wait_waitid.go @@ -29,7 +29,10 @@ func (p *Process) blockUntilWaitable() (bool, error) { psig := &siginfo[0] 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) - return errno + if errno != 0 { + return errno + } + return nil }) runtime.KeepAlive(p) if err != nil {