diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-15 11:55:43 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-15 11:57:07 +0200 |
commit | 70c949a42b2b0d0c9a2a567890483940cdc5f72c (patch) | |
tree | 11bd2bc1e49e2e89e19528b669f5af04cea3a9d6 /src/shared/cgroup-util.c | |
parent | ce049dcda4a9d0c9a44667ca82bc9e21d7ea7748 (diff) |
cgroup: never try to create files in cgroupfs, only open them for writing
This should have the benefit that cg_set_attribute() returns ENOENT
instead of EACCESS when we use it for non-existing attributes.
Diffstat (limited to 'src/shared/cgroup-util.c')
-rw-r--r-- | src/shared/cgroup-util.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c index f683ae990e..e8cb9c73ac 100644 --- a/src/shared/cgroup-util.c +++ b/src/shared/cgroup-util.c @@ -643,7 +643,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { snprintf(c, sizeof(c), PID_FMT"\n", pid); - return write_string_file(fs, c); + return write_string_file_no_create(fs, c); } int cg_attach_fallback(const char *controller, const char *path, pid_t pid) { @@ -817,7 +817,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { sc = strstrip(contents); if (sc[0] == 0) { - r = write_string_file(fs, agent); + r = write_string_file_no_create(fs, agent); if (r < 0) return r; } else if (!streq(sc, agent)) @@ -837,7 +837,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { sc = strstrip(contents); if (streq(sc, "0")) { - r = write_string_file(fs, "1"); + r = write_string_file_no_create(fs, "1"); if (r < 0) return r; @@ -858,7 +858,7 @@ int cg_uninstall_release_agent(const char *controller) { if (r < 0) return r; - r = write_string_file(fs, "0"); + r = write_string_file_no_create(fs, "0"); if (r < 0) return r; @@ -869,7 +869,7 @@ int cg_uninstall_release_agent(const char *controller) { if (r < 0) return r; - r = write_string_file(fs, ""); + r = write_string_file_no_create(fs, ""); if (r < 0) return r; @@ -1591,7 +1591,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri if (r < 0) return r; - return write_string_file(p, value); + return write_string_file_no_create(p, value); } static const char mask_names[] = |