]> Cypherpunks repositories - gostls13.git/commitdiff
os: correctly handle errno==0 in (*Process).blockUntilWaitable
authorDamien Neil <dneil@google.com>
Mon, 18 Nov 2024 22:39:20 +0000 (14:39 -0800)
committerGopher Robot <gobot@golang.org>
Mon, 18 Nov 2024 23:26:47 +0000 (23:26 +0000)
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>

src/os/wait_wait6.go
src/os/wait_waitid.go

index 00848bfdc28e5b850b03c94fcf8822a607ca7e8e..113535e5bdeb38babc255911a7ca5bcdfe28cbf1 100644 (file)
@@ -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 {
index 73012404ebda225e21c9dfca2e57afc56f4bec46..f2447a0e4c21c88f658e7ecbe7231659d951f337 100644 (file)
@@ -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 {