]> Cypherpunks repositories - gostls13.git/commitdiff
os: don't allow Process.Kill after Process.Release
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 28 Feb 2014 16:31:12 +0000 (08:31 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 28 Feb 2014 16:31:12 +0000 (08:31 -0800)
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

index 848a5de8f98e56878e72f1880fe47a35b2fdfcd0..1b1e3350b840c9e498c65778d1afe03457255918 100644 (file)
@@ -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")