Skip to content

Commit ac26d3d

Browse files
authored
Merge pull request #4320 from kolyshkin/nits
Some nits I found from older PRs
2 parents 9d60019 + 2cb46c6 commit ac26d3d

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

exec.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
219219
}
220220
p := spec.Process
221221
p.Args = context.Args()[1:]
222-
// override the cwd, if passed
223-
if context.String("cwd") != "" {
224-
p.Cwd = context.String("cwd")
222+
// Override the cwd, if passed.
223+
if cwd := context.String("cwd"); cwd != "" {
224+
p.Cwd = cwd
225225
}
226226
if ap := context.String("apparmor"); ap != "" {
227227
p.ApparmorProfile = ap
@@ -240,27 +240,24 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
240240
// append the passed env variables
241241
p.Env = append(p.Env, context.StringSlice("env")...)
242242

243-
// set the tty
244-
p.Terminal = false
245-
if context.IsSet("tty") {
246-
p.Terminal = context.Bool("tty")
247-
}
243+
// Always set tty to false, unless explicitly enabled from CLI.
244+
p.Terminal = context.Bool("tty")
248245
if context.IsSet("no-new-privs") {
249246
p.NoNewPrivileges = context.Bool("no-new-privs")
250247
}
251-
// override the user, if passed
252-
if context.String("user") != "" {
253-
u := strings.SplitN(context.String("user"), ":", 2)
248+
// Override the user, if passed.
249+
if user := context.String("user"); user != "" {
250+
u := strings.SplitN(user, ":", 2)
254251
if len(u) > 1 {
255252
gid, err := strconv.Atoi(u[1])
256253
if err != nil {
257-
return nil, fmt.Errorf("parsing %s as int for gid failed: %w", u[1], err)
254+
return nil, fmt.Errorf("bad gid: %w", err)
258255
}
259256
p.User.GID = uint32(gid)
260257
}
261258
uid, err := strconv.Atoi(u[0])
262259
if err != nil {
263-
return nil, fmt.Errorf("parsing %s as int for uid failed: %w", u[0], err)
260+
return nil, fmt.Errorf("bad uid: %w", err)
264261
}
265262
p.User.UID = uint32(uid)
266263
}

script/keyring_validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ echo "------------------------------------------------------------"
7373
gpg --show-keys <"$root/$project.keyring"
7474
echo "------------------------------------------------------------"
7575

76-
# Check that each entry in the kering is actually a maintainer's key.
76+
# Check that each entry in the keyring is actually a maintainer's key.
7777
while IFS="" read -d $'\0' -r block || [ -n "$block" ]; do
7878
username="$(sed -En "s|^Comment:.* github=(\w+).*|\1|p" <<<"$block")"
7979

0 commit comments

Comments
 (0)