summaryrefslogtreecommitdiff
path: root/src/core/cgroup-attr.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-01-18 01:44:41 +0100
committerLennart Poettering <lennart@poettering.net>2013-01-18 01:44:41 +0100
commitd2a30975827b3447ca0fd5a2c06ec1ff15ce7f0f (patch)
tree65d593f4f9d129354ab081b6476ce46a596dd7a6 /src/core/cgroup-attr.c
parentd54110d11d5ea3381cfdd129356b91669b547216 (diff)
systemctl: add new "get-cgroup-attr" to query current cgroup attribute value
Also adds a pair of bus calls for this to the daemon.
Diffstat (limited to 'src/core/cgroup-attr.c')
-rw-r--r--src/core/cgroup-attr.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/core/cgroup-attr.c b/src/core/cgroup-attr.c
index cedf37de50..aed4e99d86 100644
--- a/src/core/cgroup-attr.c
+++ b/src/core/cgroup-attr.c
@@ -25,8 +25,7 @@
int cgroup_attribute_apply(CGroupAttribute *a, CGroupBonding *b) {
int r;
- char *path = NULL;
- char *v = NULL;
+ _cleanup_free_ char *path = NULL, *v = NULL;
assert(a);
@@ -41,18 +40,13 @@ int cgroup_attribute_apply(CGroupAttribute *a, CGroupBonding *b) {
}
r = cg_get_path(a->controller, b->path, a->name, &path);
- if (r < 0) {
- free(v);
+ if (r < 0)
return r;
- }
r = write_one_line_file(path, v ? v : a->value);
if (r < 0)
log_warning("Failed to write '%s' to %s: %s", v ? v : a->value, path, strerror(-r));
- free(path);
- free(v);
-
return r;
}