]> Cypherpunks repositories - gostls13.git/commit
runtime: handle SIGPIPE in c-archive and c-shared programs
authorElias Naur <elias.naur@gmail.com>
Sun, 29 Jan 2017 14:34:50 +0000 (15:34 +0100)
committerElias Naur <elias.naur@gmail.com>
Fri, 3 Feb 2017 20:07:36 +0000 (20:07 +0000)
commit78074f6850c34a955d69f578e363d1d3f3e00e25
treedd3094b3311599ae02fcaeba5ec8585e70d3b9c1
parentb612ab3acbf3a11ea6dbaac8f244b4bdfed308cd
runtime: handle SIGPIPE in c-archive and c-shared programs

Before this CL, Go programs in c-archive or c-shared buildmodes
would not handle SIGPIPE. That leads to surprising behaviour where
writes on a closed pipe or socket would raise SIGPIPE and terminate
the program. This CL changes the Go runtime to handle
SIGPIPE regardless of buildmode. In addition, SIGPIPE from non-Go
code is forwarded.

This is a refinement of CL 32796 that fixes the case where a non-default
handler for SIGPIPE is installed by the host C program.

Fixes #17393

Change-Id: Ia41186e52c1ac209d0a594bae9904166ae7df7de
Reviewed-on: https://go-review.googlesource.com/35960
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/testcarchive/carchive_test.go
misc/cgo/testcarchive/main2.c
misc/cgo/testcarchive/main3.c
misc/cgo/testcarchive/main5.c
misc/cgo/testcarchive/src/libgo2/libgo2.go
misc/cgo/testcarchive/src/libgo3/libgo3.go
src/os/signal/doc.go
src/runtime/cgocall.go
src/runtime/runtime2.go
src/runtime/signal_unix.go