tree-wide: set WRITE_STRING_FILE_DISABLE_BUFFER flag when we write files under /proc or /sys

This commit is contained in:
Yu Watanabe
2018-11-06 21:24:03 +09:00
parent 76cdddfb9d
commit 57512c893e
14 changed files with 39 additions and 37 deletions
+3 -3
View File
@@ -47,7 +47,7 @@ static int delete_rule(const char *rule) {
if (!fn)
return log_oom();
return write_string_file(fn, "-1", 0);
return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
}
static int apply_rule(const char *rule) {
@@ -55,7 +55,7 @@ static int apply_rule(const char *rule) {
(void) delete_rule(rule);
r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
return log_error_errno(r, "Failed to add binary format: %m");
@@ -219,7 +219,7 @@ int main(int argc, char *argv[]) {
}
/* Flush out all rules */
write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
STRV_FOREACH(f, files) {
k = apply_file(*f, true);