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:
parent
38a90d45ad
commit
604028de60
|
@ -819,7 +819,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
|
||||||
|
|
||||||
xsprintf(c, PID_FMT "\n", 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)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -1101,7 +1101,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
|
||||||
|
|
||||||
sc = strstrip(contents);
|
sc = strstrip(contents);
|
||||||
if (isempty(sc)) {
|
if (isempty(sc)) {
|
||||||
r = write_string_file(fs, agent, 0);
|
r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
} else if (!path_equal(sc, agent))
|
} else if (!path_equal(sc, agent))
|
||||||
|
@ -1119,7 +1119,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
|
||||||
|
|
||||||
sc = strstrip(contents);
|
sc = strstrip(contents);
|
||||||
if (streq(sc, "0")) {
|
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)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -1146,7 +1146,7 @@ int cg_uninstall_release_agent(const char *controller) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = write_string_file(fs, "0", 0);
|
r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -1156,7 +1156,7 @@ int cg_uninstall_release_agent(const char *controller) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = write_string_file(fs, "", 0);
|
r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -2015,7 +2015,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
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) {
|
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) {
|
if (r < 0) {
|
||||||
log_debug_errno(r, "Failed to enable controller %s for %s (%s): %m", n, p, fs);
|
log_debug_errno(r, "Failed to enable controller %s for %s (%s): %m", n, p, fs);
|
||||||
clearerr(f);
|
clearerr(f);
|
||||||
|
|
Loading…
Reference in New Issue