diff options
author | Andrew Stormont <astormont@racktopsystems.com> | 2019-12-11 00:31:44 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2019-12-11 01:10:28 +0000 |
commit | a1a67e6312e4639ba9cd5263e7fbabbacd190a5f (patch) | |
tree | 288b9b69ba67ac9ed800e14303db2fdb1c9d71c3 | |
parent | 9641acd6537bc0bf6717ae523956bae94bfc38fe (diff) | |
download | go-a1a67e6312e4639ba9cd5263e7fbabbacd190a5f.tar.gz go-a1a67e6312e4639ba9cd5263e7fbabbacd190a5f.zip |
runtime: syscall_forkx on Solaris can return error on success
The syscall_forkx function returns the value of errno even on success. This can be a problem when using cgo where an atfork handler might be registered; if the atfork handler does something which causes errno to be set the caller of syscall_forkx can be misled into thinking the fork has failed. This causes the various exec functions in the runtime package to hang.
Change-Id: Ia1842179226078a0cbbea33d541aa1187dc47f68
GitHub-Last-Rev: 4dc4db75c82a826da9a50c323b7e3ddfe46ed6c0
GitHub-Pull-Request: golang/go#36076
Reviewed-on: https://go-review.googlesource.com/c/go/+/210742
Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/runtime/syscall_solaris.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/runtime/syscall_solaris.go b/src/runtime/syscall_solaris.go index 76db54d274..094516927f 100644 --- a/src/runtime/syscall_solaris.go +++ b/src/runtime/syscall_solaris.go @@ -142,6 +142,9 @@ func syscall_forkx(flags uintptr) (pid uintptr, err uintptr) { args: uintptr(unsafe.Pointer(&flags)), } asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call)) + if int(call.r1) != -1 { + call.err = 0 + } return call.r1, call.err } |