From ab35cfe23ce8029483d96528045ca8eb8e083ae8 Mon Sep 17 00:00:00 2001 From: tjucoder Date: Sun, 5 Jul 2020 12:10:47 +0800 Subject: [PATCH] make sure pty.Close() will be called and fix comment Signed-off-by: tjucoder --- libcontainer/init_linux.go | 6 +++--- libcontainer/user/user.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libcontainer/init_linux.go b/libcontainer/init_linux.go index 5487a223..f2dc17e0 100644 --- a/libcontainer/init_linux.go +++ b/libcontainer/init_linux.go @@ -184,6 +184,9 @@ func setupConsole(socket *os.File, config *initConfig, mount bool) error { return err } + // After we return from here, we don't need the console anymore. + defer pty.Close() + if config.ConsoleHeight != 0 && config.ConsoleWidth != 0 { err = pty.Resize(console.WinSize{ Height: config.ConsoleHeight, @@ -195,9 +198,6 @@ func setupConsole(socket *os.File, config *initConfig, mount bool) error { } } - // After we return from here, we don't need the console anymore. - defer pty.Close() - // Mount the console inside our rootfs. if mount { if err := mountConsole(slavePath); err != nil { diff --git a/libcontainer/user/user.go b/libcontainer/user/user.go index de30982b..4b89dad7 100644 --- a/libcontainer/user/user.go +++ b/libcontainer/user/user.go @@ -60,7 +60,7 @@ type Group struct { // groupFromOS converts an os/user.(*Group) to local Group // -// (This does not include Pass, Shell or Gecos) +// (This does not include Pass or List) func groupFromOS(g *user.Group) (Group, error) { newGroup := Group{ Name: g.Name,