File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import (
1313 "sort"
1414 "strconv"
1515 "strings"
16- "sync"
1716
1817 "github.com/containerd/containerd/defaults"
1918 "github.com/containerd/containerd/remotes/docker"
@@ -544,26 +543,18 @@ func setDefaultConfig(cfg *config.Config) {
544543 }
545544}
546545
547- var (
548- isRootlessConfigOnce sync.Once
549- isRootlessConfigValue bool
550- )
551-
552546// isRootlessConfig is true if we should be using the rootless config
553547// defaults instead of the normal defaults.
554548func isRootlessConfig () bool {
555- isRootlessConfigOnce .Do (func () {
556- if ! userns .RunningInUserNS () {
557- // Default value is false so keep it that way.
558- return
559- }
560- // if buildkitd is being executed as the mapped-root (not only EUID==0 but also $USER==root)
561- // in a user namespace, we don't want to load the rootless changes in the
562- // configuration.
563- u := os .Getenv ("USER" )
564- isRootlessConfigValue = u != "" && u != "root"
565- })
566- return isRootlessConfigValue
549+ if ! userns .RunningInUserNS () {
550+ // Default value is false so keep it that way.
551+ return false
552+ }
553+ // if buildkitd is being executed as the mapped-root (not only EUID==0 but also $USER==root)
554+ // in a user namespace, we don't want to load the rootless changes in the
555+ // configuration.
556+ u := os .Getenv ("USER" )
557+ return u != "" && u != "root"
567558}
568559
569560func applyMainFlags (c * cli.Context , cfg * config.Config ) error {
You can’t perform that action at this time.
0 commit comments