Merge pull request #128 from tonistiigi/fix-userns

Fix userns mapping for tty
This commit is contained in:
Michael Crosby 2016-03-11 09:24:21 -08:00
commit 22dac6af92
2 changed files with 8 additions and 3 deletions

View file

@ -193,7 +193,7 @@ func (c *container) readSpec() (*specs.PlatformSpec, error) {
return nil, err
}
defer f.Close()
if err := json.NewDecoder(f).Decode(&spec.Spec); err != nil {
if err := json.NewDecoder(f).Decode(&spec); err != nil {
return nil, err
}
return &spec, nil

View file

@ -166,7 +166,7 @@ func (c *container) Start(checkpoint string, s Stdio) (Process, error) {
return p, nil
}
func (c *container) Exec(pid string, spec specs.ProcessSpec, s Stdio) (Process, error) {
func (c *container) Exec(pid string, pspec specs.ProcessSpec, s Stdio) (Process, error) {
processRoot := filepath.Join(c.root, c.id, pid)
if err := os.Mkdir(processRoot, 0755); err != nil {
return nil, err
@ -178,12 +178,17 @@ func (c *container) Exec(pid string, spec specs.ProcessSpec, s Stdio) (Process,
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
spec, err := c.readSpec()
if err != nil {
return nil, err
}
config := &processConfig{
exec: true,
id: pid,
root: processRoot,
c: c,
processSpec: spec,
processSpec: pspec,
spec: spec,
stdio: s,
}
p, err := newProcess(config)