Merge pull request #627 from mrunalp/add_groups_check

Only try to get AdditionalGroups if they are configured.
This commit is contained in:
Daniel, Dao Quang Minh 2015-06-15 17:03:53 +08:00
commit 5dc7ba0f24
1 changed files with 6 additions and 3 deletions

View File

@ -178,9 +178,12 @@ func setupUser(config *initConfig) error {
return err
}
addGroups, err := user.GetAdditionalGroupsPath(config.Config.AdditionalGroups, groupPath)
if err != nil {
return err
var addGroups []int
if len(config.Config.AdditionalGroups) > 0 {
addGroups, err = user.GetAdditionalGroupsPath(config.Config.AdditionalGroups, groupPath)
if err != nil {
return err
}
}
suppGroups := append(execUser.Sgids, addGroups...)