diff --git a/libcontainer/cgroups/fs/freezer.go b/libcontainer/cgroups/fs/freezer.go index ed57f8b..432018f 100644 --- a/libcontainer/cgroups/fs/freezer.go +++ b/libcontainer/cgroups/fs/freezer.go @@ -12,18 +12,20 @@ type freezerGroup struct { } func (s *freezerGroup) Set(d *data) error { - dir, err := d.join("freezer") - if err != nil { - if err != cgroups.ErrNotFound { + switch d.c.Freezer { + case cgroups.Frozen, cgroups.Thawed: + dir, err := d.path("freezer") + if err != nil { return err } - return nil - } - if d.c.Freezer != cgroups.Undefined { if err := writeFile(dir, "freezer.state", string(d.c.Freezer)); err != nil { return err } + default: + if _, err := d.join("freezer"); err != nil && err != cgroups.ErrNotFound { + return err + } } return nil