From 7d32656ee76626fd138840af5d4c43130ae36456 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Wed, 29 Apr 2015 18:26:18 +0300 Subject: [PATCH] cr: handle all external descriptros in ct.Restore() Signed-off-by: Andrey Vagin --- container_linux.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/container_linux.go b/container_linux.go index 3b135173..8f8de127 100644 --- a/container_linux.go +++ b/container_linux.go @@ -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")) if err != nil { return err @@ -501,12 +501,11 @@ func (c *linuxContainer) Restore(process *Process, criuOpts *CriuOpts) error { return err } - var i int32 - for i = 0; i < 3; i++ { + for i := range fds { if s := fds[i]; strings.Contains(s, "pipe:") { inheritFd := new(criurpc.InheritFd) inheritFd.Key = proto.String(s) - inheritFd.Fd = proto.Int32(i) + inheritFd.Fd = proto.Int32(int32(i)) req.Opts.InheritFd = append(req.Opts.InheritFd, inheritFd) } }