diff --git a/internal/jobcontainers/jobcontainer.go b/internal/jobcontainers/jobcontainer.go index d1be8635fa..706d4b8cea 100644 --- a/internal/jobcontainers/jobcontainer.go +++ b/internal/jobcontainers/jobcontainer.go @@ -206,7 +206,7 @@ func (c *JobContainer) CreateProcess(ctx context.Context, config interface{}) (_ } var token windows.Token - if getUserTokenInheritAnnotation(c.spec.Annotations) { + if inheritUserTokenIsSet(c.spec.Annotations) { token, err = openCurrentProcessToken() if err != nil { return nil, err diff --git a/internal/jobcontainers/oci.go b/internal/jobcontainers/oci.go index adb5815ca3..da01236ae9 100644 --- a/internal/jobcontainers/oci.go +++ b/internal/jobcontainers/oci.go @@ -12,13 +12,14 @@ import ( specs "github.com/opencontainers/runtime-spec/specs-go" ) -const processorWeightMax = 10000 - // This file contains helpers for converting parts of the oci spec to useful // structures/limits to be applied to a job object. -func getUserTokenInheritAnnotation(annots map[string]string) bool { - val, ok := annots[annotations.HostProcessInheritUser] - return ok && val == "true" + +const processorWeightMax = 10000 + +// inheritUserTokenIsSet checks if the annotation that specifies whether we should inherit the token of the current process is set. +func inheritUserTokenIsSet(annots map[string]string) bool { + return annots[annotations.HostProcessInheritUser] == "true" } // Oci spec to job object limit information. Will do any conversions to job object specific values from