diff --git a/exec.go b/exec.go index a03c0b98008..f7bd7669042 100644 --- a/exec.go +++ b/exec.go @@ -247,15 +247,15 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) { } // Override the user, if passed. if user := context.String("user"); user != "" { - uidString, gidString, doesHaveGid := strings.Cut(user, ":") - if doesHaveGid { - gid, err := strconv.Atoi(gidString) + uids, gids, ok := strings.Cut(user, ":") + if ok { + gid, err := strconv.Atoi(gids) if err != nil { return nil, fmt.Errorf("bad gid: %w", err) } p.User.GID = uint32(gid) } - uid, err := strconv.Atoi(uidString) + uid, err := strconv.Atoi(uids) if err != nil { return nil, fmt.Errorf("bad uid: %w", err) }