diff --git a/virtcontainers/shim.go b/virtcontainers/shim.go index b82357f643..6a49ec9099 100644 --- a/virtcontainers/shim.go +++ b/virtcontainers/shim.go @@ -191,15 +191,6 @@ func startShim(args []string, params ShimParams) (int, error) { cmd.Stderr = os.Stderr } - cloneFlags := 0 - for _, nsType := range params.CreateNS { - cloneFlags |= ns.CloneFlagsTable[nsType] - } - - cmd.SysProcAttr = &syscall.SysProcAttr{ - Cloneflags: uintptr(cloneFlags), - } - var f *os.File var err error if params.Console != "" { @@ -211,11 +202,13 @@ func startShim(args []string, params ShimParams) (int, error) { cmd.Stdin = f cmd.Stdout = f cmd.Stderr = f - // Create Session - cmd.SysProcAttr.Setsid = true - // Set Controlling terminal to Ctty - cmd.SysProcAttr.Setctty = true - cmd.SysProcAttr.Ctty = int(f.Fd()) + cmd.SysProcAttr = &syscall.SysProcAttr{ + // Create Session + Setsid: true, + // Set Controlling terminal to Ctty + Setctty: true, + Ctty: int(f.Fd()), + } } defer func() { if f != nil { @@ -223,9 +216,7 @@ func startShim(args []string, params ShimParams) (int, error) { } }() - if err := ns.NsEnter(params.EnterNS, func() error { - return cmd.Start() - }); err != nil { + if err := cmd.Start(); err != nil { return -1, err }