浏览代码

Merge pull request #10882 from LK4D4/fix_possible_panic_on_kill

Fix possible panic on killing container
Jessie Frazelle 10 年之前
父节点
当前提交
d125936015
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      daemon/execdriver/native/driver.go

+ 4 - 0
daemon/execdriver/native/driver.go

@@ -4,6 +4,7 @@ package native
 
 import (
 	"encoding/json"
+	"errors"
 	"fmt"
 	"io"
 	"io/ioutil"
@@ -173,6 +174,9 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
 }
 
 func (d *driver) Kill(p *execdriver.Command, sig int) error {
+	if p.ProcessConfig.Process == nil {
+		return errors.New("exec: not started")
+	}
 	return syscall.Kill(p.ProcessConfig.Process.Pid, syscall.Signal(sig))
 }