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 return nil, err
} }
defer f.Close() 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 nil, err
} }
return &spec, nil return &spec, nil

View file

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