Fix userns mapping for tty

- Linux part of the spec was ignored
- Exec used empty spec

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2016-03-10 23:08:54 -08:00
parent 0abc46f9e8
commit 4700b961ca
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)