Only set socket on non-nil type creation

Because of go interface unpacking we need to only set the interface on
the opts when we actually have a socket.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-04-13 09:47:14 -07:00
parent 4a749ad473
commit e46109ba81
2 changed files with 12 additions and 9 deletions

View File

@@ -73,10 +73,12 @@ func newInitProcess(context context.Context, path string, r *shimapi.CreateReque
p.io = io
}
opts := &runc.CreateOpts{
PidFile: filepath.Join(path, "init.pid"),
ConsoleSocket: socket,
IO: io,
NoPivot: r.NoPivot,
PidFile: filepath.Join(path, "init.pid"),
IO: io,
NoPivot: r.NoPivot,
}
if socket != nil {
opts.ConsoleSocket = socket
}
if err := p.runc.Create(context, r.ID, r.Bundle, opts); err != nil {
return nil, err