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, ...@@ -1157,8 +1157,10 @@ static int restore_cgroup_prop(const CgroupPropEntry * cg_prop_entry_p,
goto out; goto out;
/* skip these two since restoring their values doesn't make sense */ /* 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; goto out;
}
len = strlen(cg_prop_entry_p->value); len = strlen(cg_prop_entry_p->value);
if (write(fd, cg_prop_entry_p->value, len) != len) { 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, ...@@ -1166,11 +1168,11 @@ static int restore_cgroup_prop(const CgroupPropEntry * cg_prop_entry_p,
goto out; goto out;
} }
ret = 0;
out: out:
if (close(fd) != 0) if (close(fd) != 0)
pr_perror("Failed closing %s", path); pr_perror("Failed closing %s", path);
else
ret = 0;
return ret; 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