Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit 5dc7ba0

Browse files
committed
Merge pull request #627 from mrunalp/add_groups_check
Only try to get AdditionalGroups if they are configured.
2 parents 61adc0d + ab3d3ce commit 5dc7ba0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

init_linux.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,12 @@ func setupUser(config *initConfig) error {
178178
return err
179179
}
180180

181-
addGroups, err := user.GetAdditionalGroupsPath(config.Config.AdditionalGroups, groupPath)
182-
if err != nil {
183-
return err
181+
var addGroups []int
182+
if len(config.Config.AdditionalGroups) > 0 {
183+
addGroups, err = user.GetAdditionalGroupsPath(config.Config.AdditionalGroups, groupPath)
184+
if err != nil {
185+
return err
186+
}
184187
}
185188

186189
suppGroups := append(execUser.Sgids, addGroups...)

0 commit comments

Comments
 (0)