From 07e2b4049be2f99ff3dca57b942769c017b12360 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 28 Feb 2014 08:31:12 -0800 Subject: [PATCH] os: don't allow Process.Kill after Process.Release This is a user error, but killing -1 kills everything, which is a pretty bad failure mode. Fixes #7434 LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/70140043 --- src/pkg/os/exec_unix.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pkg/os/exec_unix.go b/src/pkg/os/exec_unix.go index 848a5de8f9..1b1e3350b8 100644 --- a/src/pkg/os/exec_unix.go +++ b/src/pkg/os/exec_unix.go @@ -38,6 +38,9 @@ func (p *Process) signal(sig Signal) error { if p.done() { return errors.New("os: process already finished") } + if p.Pid == -1 { + return errors.New("os: process already released") + } s, ok := sig.(syscall.Signal) if !ok { return errors.New("os: unsupported signal type") -- 2.48.1