Commit 7e588c1d authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

cgroup: actually fail if property writes fail

Before, as long as we successfully closed the prop fd, the property write
would succeed.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent e4abe081
......@@ -1157,8 +1157,10 @@ static int restore_cgroup_prop(const CgroupPropEntry * cg_prop_entry_p,
goto out;
/* skip these two since restoring their values doesn't make sense */
if (!strcmp(cg_prop_entry_p->name, "cgroup.procs") || !strcmp(cg_prop_entry_p->name, "tasks"))
if (!strcmp(cg_prop_entry_p->name, "cgroup.procs") || !strcmp(cg_prop_entry_p->name, "tasks")) {
ret = 0;
goto out;
}
len = strlen(cg_prop_entry_p->value);
if (write(fd, cg_prop_entry_p->value, len) != len) {
......@@ -1166,11 +1168,11 @@ static int restore_cgroup_prop(const CgroupPropEntry * cg_prop_entry_p,
goto out;
}
ret = 0;
out:
if (close(fd) != 0)
pr_perror("Failed closing %s", path);
else
ret = 0;
return ret;
}
......
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