cr: handle all external descriptros in ct.Restore()

Signed-off-by: Andrey Vagin <avagin@openvz.org>
This commit is contained in:
Andrey Vagin 2015-04-29 18:26:18 +03:00 committed by Michael Crosby
parent 78a21b77b2
commit 7d32656ee7
1 changed files with 3 additions and 4 deletions

View File

@ -490,7 +490,7 @@ func (c *linuxContainer) Restore(process *Process, criuOpts *CriuOpts) error {
} }
} }
var fds [3]string var fds []string
fdJSON, err := ioutil.ReadFile(filepath.Join(criuOpts.ImagesDirectory, "std_fds.json")) fdJSON, err := ioutil.ReadFile(filepath.Join(criuOpts.ImagesDirectory, "std_fds.json"))
if err != nil { if err != nil {
return err return err
@ -501,12 +501,11 @@ func (c *linuxContainer) Restore(process *Process, criuOpts *CriuOpts) error {
return err return err
} }
var i int32 for i := range fds {
for i = 0; i < 3; i++ {
if s := fds[i]; strings.Contains(s, "pipe:") { if s := fds[i]; strings.Contains(s, "pipe:") {
inheritFd := new(criurpc.InheritFd) inheritFd := new(criurpc.InheritFd)
inheritFd.Key = proto.String(s) inheritFd.Key = proto.String(s)
inheritFd.Fd = proto.Int32(i) inheritFd.Fd = proto.Int32(int32(i))
req.Opts.InheritFd = append(req.Opts.InheritFd, inheritFd) req.Opts.InheritFd = append(req.Opts.InheritFd, inheritFd)
} }
} }