Skip to content

Commit

Permalink
env: fix nil pointer when no cgroup enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
criyle committed Jan 27, 2025
1 parent 3218fcb commit 49f091c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion env/env_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ func NewBuilder(c Config) (pool.EnvBuilder, map[string]any, error) {
if cgb == nil {
cgroupType = 0
}
cgroupControllers := []string{}
if ct != nil {
cgroupControllers = ct.Names()
}
return linuxcontainer.NewEnvBuilder(linuxcontainer.Config{
Builder: b,
CgroupPool: cgroupPool,
Expand All @@ -155,7 +159,7 @@ func NewBuilder(c Config) (pool.EnvBuilder, map[string]any, error) {
"uid": cUID,
"gid": cGID,

"cgroupControllers": ct.Names(),
"cgroupControllers": cgroupControllers,
}, nil
}

Expand Down

0 comments on commit 49f091c

Please sign in to comment.