From 13a5703d853fbd311e1fcfc5c95d459021781951 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Wed, 14 Jan 2015 19:39:29 +0300 Subject: [PATCH] cgroups: don't change a freezer state if an operation failed Signed-off-by: Andrey Vagin --- cgroups/fs/apply_raw.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cgroups/fs/apply_raw.go b/cgroups/fs/apply_raw.go index f05377f2..5338293f 100644 --- a/cgroups/fs/apply_raw.go +++ b/cgroups/fs/apply_raw.go @@ -124,11 +124,15 @@ func Freeze(c *cgroups.Cgroup, state cgroups.FreezerState) error { return err } + freezer := subsystems["freezer"] + err = freezer.Set(d) + if err != nil { + return err + } + c.Freezer = state - freezer := subsystems["freezer"] - - return freezer.Set(d) + return nil } func GetPids(c *cgroups.Cgroup) ([]int, error) {