Unverified Commit 81f22990 by Christian Brauner Committed by GitHub

Merge pull request #2801 from Rachid-Koucha/patch-2

Update freezer.c
parents 5283a118 9eb9ce3e
......@@ -51,10 +51,12 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
int ret;
char v[100];
struct cgroup_ops *cgroup_ops;
const char *state = freeze ? "FROZEN" : "THAWED";
const char *state;
size_t state_len = 6;
lxc_state_t new_state = freeze ? FROZEN : THAWED;
state = lxc_state2str(new_state);
cgroup_ops = cgroup_init(conf);
if (!cgroup_ops)
return -1;
......@@ -62,7 +64,7 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
ret = cgroup_ops->set(cgroup_ops, "freezer.state", state, name, lxcpath);
if (ret < 0) {
cgroup_exit(cgroup_ops);
ERROR("Failed to freeze %s", name);
ERROR("Failed to %s %s", (new_state == FROZEN ? "freeze" : "unfreeze"), name);
return -1;
}
......@@ -74,7 +76,7 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
return -1;
}
v[99] = '\0';
v[sizeof(v)-1] = '\0';
v[lxc_char_right_gc(v, strlen(v))] = '\0';
ret = strncmp(v, state, state_len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment