diff --git a/src/runtime/cgo_sigaction.go b/src/runtime/cgo_sigaction.go index 3ef6800cd9..bc5e0786d9 100644 --- a/src/runtime/cgo_sigaction.go +++ b/src/runtime/cgo_sigaction.go @@ -39,7 +39,10 @@ func sigaction(sig uint32, new, old *sigactiont) { var ret int32 - g := getg() + var g *g + if mainStarted { + g = getg() + } sp := uintptr(unsafe.Pointer(&sig)) switch { case g == nil: