mirror of
https://github.com/golang/go.git
synced 2025-05-18 13:54:40 +00:00
runtime: initialize crashFD to -1
crashFD defaults to the zero value of (surprise!) zero. Zero is a valid FD, so on the first call to SetCrashOutput we actually close FD 0 since it is a "valid" FD. Initialize crashFD to -1, the sentinel for "no FD". Change-Id: I3b108c60603f2b83b867cbe079f035c159b6a6ca Reviewed-on: https://go-review.googlesource.com/c/go/+/560776 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
6b0309ceb6
commit
3d20a327a1
@ -775,6 +775,7 @@ func schedinit() {
|
||||
}
|
||||
|
||||
sched.maxmcount = 10000
|
||||
crashFD.Store(^uintptr(0))
|
||||
|
||||
// The world starts stopped.
|
||||
worldStopped()
|
||||
|
@ -244,6 +244,8 @@ func writeErrData(data *byte, n int32) {
|
||||
// set by debug.SetCrashOutput (see #42888). If it is a valid fd (not
|
||||
// all ones), writeErr and related functions write to it in addition
|
||||
// to standard error.
|
||||
//
|
||||
// Initialized to -1 in schedinit.
|
||||
var crashFD atomic.Uintptr
|
||||
|
||||
//go:linkname setCrashFD
|
||||
|
Loading…
x
Reference in New Issue
Block a user