new-api: set Cloneflags in namespace.Exec()

This place looks more suitable.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
This commit is contained in:
Andrey Vagin 2014-12-24 11:25:00 +03:00 committed by Andrew Vagin
parent d572094b75
commit 195a08efbc
2 changed files with 2 additions and 3 deletions

View File

@ -133,8 +133,6 @@ func (c *linuxContainer) updateStateFile() error {
}
func (c *linuxContainer) startInitProcess(cmd *exec.Cmd, config *ProcessConfig) error {
cmd.SysProcAttr.Cloneflags = uintptr(namespaces.GetNamespaceFlags(c.config.Namespaces))
err := namespaces.Exec(config.Args, config.Env, cmd, c.config, c.state)
if err != nil {
return err

View File

@ -31,9 +31,10 @@ func Exec(args []string, env []string, command *exec.Cmd, container *configs.Con
return err
}
defer parent.Close()
command.ExtraFiles = []*os.File{child}
command.Dir = container.RootFs
command.SysProcAttr.Cloneflags = uintptr(GetNamespaceFlags(container.Namespaces))
if err := command.Start(); err != nil {
child.Close()