From d200a6ec73c87a2424a10b3b4e3ccbda03854ee6 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Wed, 17 Oct 2018 12:38:43 -0700 Subject: [PATCH] user: Always return supplementary groups The caller can ignore it if they don't care about using them. Signed-off-by: Mrunal Patel --- libcontainer/user/user.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libcontainer/user/user.go b/libcontainer/user/user.go index 7b912bbf8b4..c7373277f05 100644 --- a/libcontainer/user/user.go +++ b/libcontainer/user/user.go @@ -417,11 +417,10 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) ( // Okay, so it's numeric. We can just roll with this. } - } else if len(groups) > 0 { - // Supplementary group ids only make sense if in the implicit form. - user.Sgids = make([]int, len(groups)) - for i, group := range groups { - user.Sgids[i] = group.Gid + } + if len(groups) > 0 { + for _, group := range groups { + user.Sgids = append(user.Sgids, group.Gid) } } }