cgroup-util: disable buffering for cg_enable_everywhere() when writing to cgroup attributes

Let's better be safe than sorry.
This commit is contained in:
Lennart Poettering 2018-10-24 17:28:17 +02:00
parent 38a90d45ad
commit 604028de60
1 changed files with 7 additions and 7 deletions

View File

@ -819,7 +819,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
xsprintf(c, PID_FMT "\n", pid);
r = write_string_file(fs, c, 0);
r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
return r;
@ -1101,7 +1101,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
sc = strstrip(contents);
if (isempty(sc)) {
r = write_string_file(fs, agent, 0);
r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
return r;
} else if (!path_equal(sc, agent))
@ -1119,7 +1119,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", 0);
r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
return r;
@ -1146,7 +1146,7 @@ int cg_uninstall_release_agent(const char *controller) {
if (r < 0)
return r;
r = write_string_file(fs, "0", 0);
r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
return r;
@ -1156,7 +1156,7 @@ int cg_uninstall_release_agent(const char *controller) {
if (r < 0)
return r;
r = write_string_file(fs, "", 0);
r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
return r;
@ -2015,7 +2015,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, 0);
return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
}
int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
@ -2604,7 +2604,7 @@ int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p) {
}
}
r = write_string_stream(f, s, 0);
r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0) {
log_debug_errno(r, "Failed to enable controller %s for %s (%s): %m", n, p, fs);
clearerr(f);