blob: d389e1d9f9c1dc4267a5fe04d7bb833cb8c30100 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From 0f9422780a569c79a4b28e44c79c70b4a354bd92 Mon Sep 17 00:00:00 2001
Brad Bishop19323692019-04-05 15:28:33 -04002From: Chen Qi <Qi.Chen@windriver.com>
3Date: Fri, 1 Mar 2019 15:22:15 +0800
William A. Kennington IIIac69b482021-06-02 12:28:27 -07004Subject: [PATCH] do not disable buffer in writing files
Brad Bishop19323692019-04-05 15:28:33 -04005
6Do not disable buffer in writing files, otherwise we get
7failure at boot for musl like below.
8
9 [!!!!!!] Failed to allocate manager object.
10
11And there will be other failures, critical or not critical.
12This is specific to musl.
13
14Upstream-Status: Inappropriate [musl]
15
16Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Brad Bishopc342db32019-05-15 21:57:59 -040017[Rebased for v242]
18Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Brad Bishopa34c0302019-09-23 22:34:48 -040019[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
William A. Kennington IIIac69b482021-06-02 12:28:27 -070021
Brad Bishop19323692019-04-05 15:28:33 -040022---
Andrew Geissler82c905d2020-04-13 13:39:40 -050023 src/basic/cgroup-util.c | 10 +++++-----
Brad Bishop19323692019-04-05 15:28:33 -040024 src/basic/procfs-util.c | 4 ++--
William A. Kennington IIIac69b482021-06-02 12:28:27 -070025 src/basic/sysctl-util.c | 2 +-
Brad Bishop19323692019-04-05 15:28:33 -040026 src/basic/util.c | 2 +-
27 src/binfmt/binfmt.c | 6 +++---
28 src/core/main.c | 4 ++--
29 src/core/smack-setup.c | 8 ++++----
30 src/hibernate-resume/hibernate-resume.c | 2 +-
31 src/libsystemd/sd-device/sd-device.c | 2 +-
Brad Bishop19323692019-04-05 15:28:33 -040032 src/nspawn/nspawn-cgroup.c | 2 +-
33 src/nspawn/nspawn.c | 6 +++---
Andrew Geissler82c905d2020-04-13 13:39:40 -050034 src/shared/cgroup-setup.c | 4 ++--
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050035 src/shared/mount-util.c | 4 ++--
36 src/shared/smack-util.c | 2 +-
Andrew Geissler82c905d2020-04-13 13:39:40 -050037 src/sleep/sleep.c | 8 ++++----
Brad Bishop19323692019-04-05 15:28:33 -040038 src/vconsole/vconsole-setup.c | 2 +-
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050039 16 files changed, 34 insertions(+), 34 deletions(-)
Brad Bishop19323692019-04-05 15:28:33 -040040
Andrew Geisslerd1e89492021-02-12 15:35:20 -060041--- a/src/basic/cgroup-util.c
42+++ b/src/basic/cgroup-util.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000043@@ -390,7 +390,7 @@ int cg_kill_kernel_sigkill(const char *c
44 if (r < 0)
45 return r;
46
47- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
48+ r = write_string_file(killfile, "1", 0);
49 if (r < 0)
50 return r;
51
52@@ -803,7 +803,7 @@ int cg_install_release_agent(const char
Brad Bishop19323692019-04-05 15:28:33 -040053
54 sc = strstrip(contents);
55 if (isempty(sc)) {
56- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
57+ r = write_string_file(fs, agent, 0);
58 if (r < 0)
59 return r;
60 } else if (!path_equal(sc, agent))
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000061@@ -821,7 +821,7 @@ int cg_install_release_agent(const char
Brad Bishop19323692019-04-05 15:28:33 -040062
63 sc = strstrip(contents);
64 if (streq(sc, "0")) {
65- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
66+ r = write_string_file(fs, "1", 0);
67 if (r < 0)
68 return r;
69
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000070@@ -848,7 +848,7 @@ int cg_uninstall_release_agent(const cha
Brad Bishop19323692019-04-05 15:28:33 -040071 if (r < 0)
72 return r;
73
74- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
75+ r = write_string_file(fs, "0", 0);
76 if (r < 0)
77 return r;
78
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000079@@ -858,7 +858,7 @@ int cg_uninstall_release_agent(const cha
Brad Bishop19323692019-04-05 15:28:33 -040080 if (r < 0)
81 return r;
82
83- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
84+ r = write_string_file(fs, "", 0);
85 if (r < 0)
86 return r;
87
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000088@@ -1704,7 +1704,7 @@ int cg_set_attribute(const char *control
Brad Bishop19323692019-04-05 15:28:33 -040089 if (r < 0)
90 return r;
91
92- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
93+ return write_string_file(p, value, 0);
94 }
95
96 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
Andrew Geisslerd1e89492021-02-12 15:35:20 -060097--- a/src/basic/procfs-util.c
98+++ b/src/basic/procfs-util.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000099@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi
Brad Bishop19323692019-04-05 15:28:33 -0400100 * decrease it, as threads-max is the much more relevant sysctl. */
101 if (limit > pid_max-1) {
102 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
103- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
104+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
105 if (r < 0)
106 return r;
107 }
108
109 sprintf(buffer, "%" PRIu64, limit);
110- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
111+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
112 if (r < 0) {
113 uint64_t threads_max;
114
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700115--- a/src/basic/sysctl-util.c
116+++ b/src/basic/sysctl-util.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000117@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700118
119 log_debug("Setting '%s' to '%s'", p, value);
120
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000121- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
122+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700123 }
124
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000125 int sysctl_writef(const char *property, const char *format, ...) {
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600126--- a/src/basic/util.c
127+++ b/src/basic/util.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000128@@ -168,7 +168,7 @@ void disable_coredumps(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400129 if (detect_container() > 0)
130 return;
131
132- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
133+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
134 if (r < 0)
135 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
136 }
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600137--- a/src/binfmt/binfmt.c
138+++ b/src/binfmt/binfmt.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000139@@ -29,7 +29,7 @@ static bool arg_unregister = false;
Brad Bishop19323692019-04-05 15:28:33 -0400140
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000141 static int delete_rule(const char *rulename) {
142 const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename);
Brad Bishop19323692019-04-05 15:28:33 -0400143- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
144+ return write_string_file(fn, "-1", 0);
145 }
146
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000147 static int apply_rule(const char *filename, unsigned line, const char *rule) {
148@@ -59,7 +59,7 @@ static int apply_rule(const char *filena
149 if (r >= 0)
150 log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename);
Brad Bishop19323692019-04-05 15:28:33 -0400151
152- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
153+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
154 if (r < 0)
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000155 return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m",
156 filename, line, rulename);
157@@ -226,7 +226,7 @@ static int run(int argc, char *argv[]) {
Brad Bishop19323692019-04-05 15:28:33 -0400158 }
159
160 /* Flush out all rules */
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000161- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
162+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
163 if (r < 0)
164 log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
165 else
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600166--- a/src/core/main.c
167+++ b/src/core/main.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000168@@ -1466,7 +1466,7 @@ static int bump_unix_max_dgram_qlen(void
Brad Bishop19323692019-04-05 15:28:33 -0400169 if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
170 return 0;
171
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000172- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER,
173+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0,
174 "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
Brad Bishop19323692019-04-05 15:28:33 -0400175 if (r < 0)
176 return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000177@@ -1737,7 +1737,7 @@ static void initialize_core_pattern(bool
Brad Bishop19323692019-04-05 15:28:33 -0400178 if (getpid_cached() != 1)
179 return;
180
181- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
182+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
183 if (r < 0)
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000184 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
185 arg_early_core_pattern);
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600186--- a/src/core/smack-setup.c
187+++ b/src/core/smack-setup.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000188@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy)
Brad Bishop19323692019-04-05 15:28:33 -0400189 }
190
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000191 #if HAVE_SMACK_RUN_LABEL
Brad Bishop19323692019-04-05 15:28:33 -0400192- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
193+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
194 if (r < 0)
195 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
196- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
197+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
198 if (r < 0)
199 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
200 r = write_string_file("/sys/fs/smackfs/netlabel",
201- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
202+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
203 if (r < 0)
204 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
205- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
206+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
207 if (r < 0)
208 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
209 #endif
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600210--- a/src/hibernate-resume/hibernate-resume.c
211+++ b/src/hibernate-resume/hibernate-resume.c
Brad Bishop19323692019-04-05 15:28:33 -0400212@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
213 return EXIT_FAILURE;
214 }
215
216- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
217+ r = write_string_file("/sys/power/resume", major_minor, 0);
218 if (r < 0) {
219 log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
220 return EXIT_FAILURE;
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600221--- a/src/libsystemd/sd-device/sd-device.c
222+++ b/src/libsystemd/sd-device/sd-device.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000223@@ -2108,7 +2108,7 @@ _public_ int sd_device_set_sysattr_value
Brad Bishop19323692019-04-05 15:28:33 -0400224 if (!value)
225 return -ENOMEM;
226
227- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
228+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
229 if (r < 0) {
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700230 /* On failure, clear cache entry, as we do not know how it fails. */
231 device_remove_cached_sysattr_value(device, sysattr);
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600232--- a/src/nspawn/nspawn-cgroup.c
233+++ b/src/nspawn/nspawn-cgroup.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000234@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified
Brad Bishopa34c0302019-09-23 22:34:48 -0400235 fn = strjoina(tree, cgroup, "/cgroup.procs");
Brad Bishop19323692019-04-05 15:28:33 -0400236
237 sprintf(pid_string, PID_FMT, pid);
Brad Bishopa34c0302019-09-23 22:34:48 -0400238- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
239+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
Brad Bishop19323692019-04-05 15:28:33 -0400240 if (r < 0) {
241 log_error_errno(r, "Failed to move process: %m");
242 goto finish;
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600243--- a/src/nspawn/nspawn.c
244+++ b/src/nspawn/nspawn.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000245@@ -2757,7 +2757,7 @@ static int reset_audit_loginuid(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400246 if (streq(p, "4294967295"))
247 return 0;
248
249- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
250+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
251 if (r < 0) {
252 log_error_errno(r,
253 "Failed to reset audit login UID. This probably means that your kernel is too\n"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000254@@ -4163,7 +4163,7 @@ static int setup_uid_map(
Patrick Williams213cb262021-08-07 19:21:33 -0500255 return log_oom();
Brad Bishop19323692019-04-05 15:28:33 -0400256
257 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
Patrick Williams213cb262021-08-07 19:21:33 -0500258- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
259+ r = write_string_file(uid_map, s, 0);
Brad Bishop19323692019-04-05 15:28:33 -0400260 if (r < 0)
261 return log_error_errno(r, "Failed to write UID map: %m");
262
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000263@@ -4173,7 +4173,7 @@ static int setup_uid_map(
Patrick Williams213cb262021-08-07 19:21:33 -0500264 return log_oom();
265
Brad Bishop19323692019-04-05 15:28:33 -0400266 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
Patrick Williams213cb262021-08-07 19:21:33 -0500267- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
268+ r = write_string_file(uid_map, s, 0);
Brad Bishop19323692019-04-05 15:28:33 -0400269 if (r < 0)
270 return log_error_errno(r, "Failed to write GID map: %m");
271
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600272--- a/src/shared/cgroup-setup.c
273+++ b/src/shared/cgroup-setup.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000274@@ -345,7 +345,7 @@ int cg_attach(const char *controller, co
Andrew Geissler82c905d2020-04-13 13:39:40 -0500275
276 xsprintf(c, PID_FMT "\n", pid);
277
278- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
279+ r = write_string_file(fs, c, 0);
280 if (r < 0)
281 return r;
282
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000283@@ -877,7 +877,7 @@ int cg_enable_everywhere(
Andrew Geissler82c905d2020-04-13 13:39:40 -0500284 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
285 }
286
287- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
288+ r = write_string_stream(f, s, 0);
289 if (r < 0) {
290 log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
291 FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
Andrew Geisslerd159c7f2021-09-02 21:05:58 -0500292--- a/src/shared/smack-util.c
293+++ b/src/shared/smack-util.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000294@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const
Andrew Geisslerd159c7f2021-09-02 21:05:58 -0500295 return 0;
296
297 p = procfs_file_alloca(pid, "attr/current");
298- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
299+ r = write_string_file(p, label, 0);
300 if (r < 0)
301 return r;
302
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600303--- a/src/sleep/sleep.c
304+++ b/src/sleep/sleep.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000305@@ -46,7 +46,7 @@ static int write_hibernate_location_info
Andrew Geissler82c905d2020-04-13 13:39:40 -0500306 assert(hibernate_location->swap);
Brad Bishop19323692019-04-05 15:28:33 -0400307
Andrew Geissler82c905d2020-04-13 13:39:40 -0500308 xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
309- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
310+ r = write_string_file("/sys/power/resume", resume_str, 0);
311 if (r < 0)
312 return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
313 hibernate_location->swap->device, resume_str);
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000314@@ -73,7 +73,7 @@ static int write_hibernate_location_info
Andrew Geissler82c905d2020-04-13 13:39:40 -0500315 }
Brad Bishop19323692019-04-05 15:28:33 -0400316
Andrew Geissler82c905d2020-04-13 13:39:40 -0500317 xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
Brad Bishop19323692019-04-05 15:28:33 -0400318- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
319+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
320 if (r < 0)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500321 return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
322 hibernate_location->swap->device, offset_str);
Patrick Williams213cb262021-08-07 19:21:33 -0500323@@ -90,7 +90,7 @@ static int write_mode(char **modes) {
Brad Bishop19323692019-04-05 15:28:33 -0400324 STRV_FOREACH(mode, modes) {
325 int k;
326
327- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
328+ k = write_string_file("/sys/power/disk", *mode, 0);
329 if (k >= 0)
330 return 0;
331
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000332@@ -112,7 +112,7 @@ static int write_state(FILE **f, char **
Brad Bishop19323692019-04-05 15:28:33 -0400333 STRV_FOREACH(state, states) {
334 int k;
335
336- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
337+ k = write_string_stream(*f, *state, 0);
338 if (k >= 0)
339 return 0;
340 log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600341--- a/src/vconsole/vconsole-setup.c
342+++ b/src/vconsole/vconsole-setup.c
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000343@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na
Brad Bishop19323692019-04-05 15:28:33 -0400344 static int toggle_utf8_sysfs(bool utf8) {
345 int r;
346
347- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
348+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
349 if (r < 0)
350 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
351
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000352--- a/src/basic/namespace-util.c
353+++ b/src/basic/namespace-util.c
354@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map,
355 freeze();
356
357 xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
358- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
359+ r = write_string_file(path, uid_map, 0);
360 if (r < 0)
361 return log_error_errno(r, "Failed to write UID map: %m");
362
363 xsprintf(path, "/proc/" PID_FMT "/gid_map", pid);
364- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
365+ r = write_string_file(path, gid_map, 0);
366 if (r < 0)
367 return log_error_errno(r, "Failed to write GID map: %m");
368
369--- a/src/core/cgroup.c
370+++ b/src/core/cgroup.c
371@@ -4140,7 +4140,7 @@ int unit_cgroup_freezer_action(Unit *u,
372 else
373 u->freezer_state = FREEZER_THAWING;
374
375- r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER);
376+ r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0);
377 if (r < 0)
378 return r;
379
380--- a/src/home/homework.c
381+++ b/src/home/homework.c
382@@ -284,7 +284,7 @@ static void drop_caches_now(void) {
383 * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not
384 * more. */
385
386- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER);
387+ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0);
388 if (r < 0)
389 log_warning_errno(r, "Failed to drop caches, ignoring: %m");
390 else
391--- a/src/shared/binfmt-util.c
392+++ b/src/shared/binfmt-util.c
393@@ -26,7 +26,7 @@ int disable_binfmt(void) {
394 if (r < 0)
395 return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m");
396
397- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
398+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
399 if (r < 0)
400 return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");
401
402--- a/src/shared/coredump-util.c
403+++ b/src/shared/coredump-util.c
404@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value)
405 sprintf(t, "0x%"PRIx64, value);
406
407 return write_string_file("/proc/self/coredump_filter", t,
408- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
409+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
410 }
411--- a/src/udev/udev-rules.c
412+++ b/src/udev/udev-rules.c
413@@ -2181,7 +2181,6 @@ static int udev_rule_apply_token_to_even
414 log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
415 r = write_string_file(buf, value,
416 WRITE_STRING_FILE_VERIFY_ON_FAILURE |
417- WRITE_STRING_FILE_DISABLE_BUFFER |
418 WRITE_STRING_FILE_AVOID_NEWLINE |
419 WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
420 if (r < 0)