blob: 4eeec7b7dac1d120da0089501d8b78a83809e46a [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From f92fd7e77ed5aab2dda01a20e6891c37f09415d3 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
4Subject: [PATCH] do not disable buffer in writing files
5
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>
Andrew Geissler82c905d2020-04-13 13:39:40 -050021
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 ++--
25 src/basic/smack-util.c | 2 +-
26 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 +-
32 src/login/logind-dbus.c | 2 +-
Brad Bishop19323692019-04-05 15:28:33 -040033 src/nspawn/nspawn-cgroup.c | 2 +-
34 src/nspawn/nspawn.c | 6 +++---
Andrew Geissler82c905d2020-04-13 13:39:40 -050035 src/shared/cgroup-setup.c | 4 ++--
Brad Bishopc342db32019-05-15 21:57:59 -040036 src/shared/sysctl-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/udev/udevadm-trigger.c | 2 +-
Brad Bishopa34c0302019-09-23 22:34:48 -040039 src/udev/udevd.c | 2 +-
Brad Bishop19323692019-04-05 15:28:33 -040040 src/vconsole/vconsole-setup.c | 2 +-
Andrew Geissler82c905d2020-04-13 13:39:40 -050041 18 files changed, 35 insertions(+), 35 deletions(-)
Brad Bishop19323692019-04-05 15:28:33 -040042
43diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050044index a5141f4cbedd..04c06e7a55cb 100644
Brad Bishop19323692019-04-05 15:28:33 -040045--- a/src/basic/cgroup-util.c
46+++ b/src/basic/cgroup-util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050047@@ -739,7 +739,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
Brad Bishop19323692019-04-05 15:28:33 -040048
49 sc = strstrip(contents);
50 if (isempty(sc)) {
51- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
52+ r = write_string_file(fs, agent, 0);
53 if (r < 0)
54 return r;
55 } else if (!path_equal(sc, agent))
Andrew Geissler82c905d2020-04-13 13:39:40 -050056@@ -757,7 +757,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
Brad Bishop19323692019-04-05 15:28:33 -040057
58 sc = strstrip(contents);
59 if (streq(sc, "0")) {
60- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
61+ r = write_string_file(fs, "1", 0);
62 if (r < 0)
63 return r;
64
Andrew Geissler82c905d2020-04-13 13:39:40 -050065@@ -784,7 +784,7 @@ int cg_uninstall_release_agent(const char *controller) {
Brad Bishop19323692019-04-05 15:28:33 -040066 if (r < 0)
67 return r;
68
69- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
70+ r = write_string_file(fs, "0", 0);
71 if (r < 0)
72 return r;
73
Andrew Geissler82c905d2020-04-13 13:39:40 -050074@@ -794,7 +794,7 @@ int cg_uninstall_release_agent(const char *controller) {
Brad Bishop19323692019-04-05 15:28:33 -040075 if (r < 0)
76 return r;
77
78- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
79+ r = write_string_file(fs, "", 0);
80 if (r < 0)
81 return r;
82
Andrew Geissler82c905d2020-04-13 13:39:40 -050083@@ -1650,7 +1650,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
Brad Bishop19323692019-04-05 15:28:33 -040084 if (r < 0)
85 return r;
86
87- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
88+ return write_string_file(p, value, 0);
89 }
90
91 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
Brad Bishop19323692019-04-05 15:28:33 -040092diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050093index da7e836f143e..2138f20bcc03 100644
Brad Bishop19323692019-04-05 15:28:33 -040094--- a/src/basic/procfs-util.c
95+++ b/src/basic/procfs-util.c
Brad Bishopa34c0302019-09-23 22:34:48 -040096@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
Brad Bishop19323692019-04-05 15:28:33 -040097 * decrease it, as threads-max is the much more relevant sysctl. */
98 if (limit > pid_max-1) {
99 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
100- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
101+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
102 if (r < 0)
103 return r;
104 }
105
106 sprintf(buffer, "%" PRIu64, limit);
107- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
108+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
109 if (r < 0) {
110 uint64_t threads_max;
111
112diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500113index da9a2139d31a..5e91f5b8f5d9 100644
Brad Bishop19323692019-04-05 15:28:33 -0400114--- a/src/basic/smack-util.c
115+++ b/src/basic/smack-util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500116@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
Brad Bishop19323692019-04-05 15:28:33 -0400117 return 0;
118
119 p = procfs_file_alloca(pid, "attr/current");
120- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
121+ r = write_string_file(p, label, 0);
122 if (r < 0)
123 return r;
124
125diff --git a/src/basic/util.c b/src/basic/util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500126index 2b3b3918a32f..aff8d0fcd473 100644
Brad Bishop19323692019-04-05 15:28:33 -0400127--- a/src/basic/util.c
128+++ b/src/basic/util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500129@@ -267,7 +267,7 @@ void disable_coredumps(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400130 if (detect_container() > 0)
131 return;
132
133- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
134+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
135 if (r < 0)
136 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
137 }
138diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500139index 7ff844c78c3a..5c5721d7c2f7 100644
Brad Bishop19323692019-04-05 15:28:33 -0400140--- a/src/binfmt/binfmt.c
141+++ b/src/binfmt/binfmt.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500142@@ -47,7 +47,7 @@ static int delete_rule(const char *rule) {
Brad Bishop19323692019-04-05 15:28:33 -0400143 if (!fn)
144 return log_oom();
145
146- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
147+ return write_string_file(fn, "-1", 0);
148 }
149
150 static int apply_rule(const char *rule) {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500151@@ -55,7 +55,7 @@ static int apply_rule(const char *rule) {
Brad Bishop19323692019-04-05 15:28:33 -0400152
153 (void) delete_rule(rule);
154
155- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
156+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
157 if (r < 0)
158 return log_error_errno(r, "Failed to add binary format: %m");
159
Andrew Geissler82c905d2020-04-13 13:39:40 -0500160@@ -212,7 +212,7 @@ static int run(int argc, char *argv[]) {
Brad Bishop19323692019-04-05 15:28:33 -0400161 }
162
163 /* Flush out all rules */
Brad Bishopa34c0302019-09-23 22:34:48 -0400164- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
165+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
Brad Bishop19323692019-04-05 15:28:33 -0400166
167 STRV_FOREACH(f, files) {
168 k = apply_file(*f, true);
169diff --git a/src/core/main.c b/src/core/main.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500170index 3c6b66e89c8e..c39ebe56a5b3 100644
Brad Bishop19323692019-04-05 15:28:33 -0400171--- a/src/core/main.c
172+++ b/src/core/main.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500173@@ -1312,7 +1312,7 @@ static int bump_unix_max_dgram_qlen(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400174 if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
175 return 0;
176
177- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
178+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
179 if (r < 0)
180 return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
181 "Failed to bump AF_UNIX datagram queue length, ignoring: %m");
Andrew Geissler82c905d2020-04-13 13:39:40 -0500182@@ -1536,7 +1536,7 @@ static void initialize_core_pattern(bool skip_setup) {
Brad Bishop19323692019-04-05 15:28:33 -0400183 if (getpid_cached() != 1)
184 return;
185
186- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
187+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
188 if (r < 0)
189 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
190 }
191diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500192index 4427397f2715..8aeb5c829513 100644
Brad Bishop19323692019-04-05 15:28:33 -0400193--- a/src/core/smack-setup.c
194+++ b/src/core/smack-setup.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400195@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) {
Brad Bishop19323692019-04-05 15:28:33 -0400196 }
197
198 #ifdef SMACK_RUN_LABEL
199- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
200+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
201 if (r < 0)
202 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
203- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
204+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
205 if (r < 0)
206 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
207 r = write_string_file("/sys/fs/smackfs/netlabel",
208- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
209+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
210 if (r < 0)
211 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
212- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
213+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
214 if (r < 0)
215 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
216 #endif
217diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500218index 17e7cd1a009b..87a766771663 100644
Brad Bishop19323692019-04-05 15:28:33 -0400219--- a/src/hibernate-resume/hibernate-resume.c
220+++ b/src/hibernate-resume/hibernate-resume.c
221@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
222 return EXIT_FAILURE;
223 }
224
225- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
226+ r = write_string_file("/sys/power/resume", major_minor, 0);
227 if (r < 0) {
228 log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
229 return EXIT_FAILURE;
230diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500231index 1f2451f8e1b4..3f676ec2841a 100644
Brad Bishop19323692019-04-05 15:28:33 -0400232--- a/src/libsystemd/sd-device/sd-device.c
233+++ b/src/libsystemd/sd-device/sd-device.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400234@@ -1849,7 +1849,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
Brad Bishop19323692019-04-05 15:28:33 -0400235 if (!value)
236 return -ENOMEM;
237
238- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
239+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
240 if (r < 0) {
241 if (r == -ELOOP)
242 return -EINVAL;
243diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500244index 52a7ea3c77e9..9703de0dabee 100644
Brad Bishop19323692019-04-05 15:28:33 -0400245--- a/src/login/logind-dbus.c
246+++ b/src/login/logind-dbus.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500247@@ -1339,7 +1339,7 @@ static int trigger_device(Manager *m, sd_device *d) {
Brad Bishop19323692019-04-05 15:28:33 -0400248 if (!t)
249 return -ENOMEM;
250
251- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
252+ (void) write_string_file(t, "change", 0);
253 }
254
255 return 0;
Brad Bishop19323692019-04-05 15:28:33 -0400256diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500257index f5048d9473cb..b6383ab5c97e 100644
Brad Bishop19323692019-04-05 15:28:33 -0400258--- a/src/nspawn/nspawn-cgroup.c
259+++ b/src/nspawn/nspawn-cgroup.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500260@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
Brad Bishopa34c0302019-09-23 22:34:48 -0400261 fn = strjoina(tree, cgroup, "/cgroup.procs");
Brad Bishop19323692019-04-05 15:28:33 -0400262
263 sprintf(pid_string, PID_FMT, pid);
Brad Bishopa34c0302019-09-23 22:34:48 -0400264- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
265+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
Brad Bishop19323692019-04-05 15:28:33 -0400266 if (r < 0) {
267 log_error_errno(r, "Failed to move process: %m");
268 goto finish;
269diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500270index 734dee1130e0..71add9a055d2 100644
Brad Bishop19323692019-04-05 15:28:33 -0400271--- a/src/nspawn/nspawn.c
272+++ b/src/nspawn/nspawn.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500273@@ -2440,7 +2440,7 @@ static int reset_audit_loginuid(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400274 if (streq(p, "4294967295"))
275 return 0;
276
277- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
278+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
279 if (r < 0) {
280 log_error_errno(r,
281 "Failed to reset audit login UID. This probably means that your kernel is too\n"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500282@@ -3665,13 +3665,13 @@ static int setup_uid_map(pid_t pid) {
Brad Bishop19323692019-04-05 15:28:33 -0400283
284 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
285 xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range);
286- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
287+ r = write_string_file(uid_map, line, 0);
288 if (r < 0)
289 return log_error_errno(r, "Failed to write UID map: %m");
290
291 /* We always assign the same UID and GID ranges */
292 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
293- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
294+ r = write_string_file(uid_map, line, 0);
295 if (r < 0)
296 return log_error_errno(r, "Failed to write GID map: %m");
297
Andrew Geissler82c905d2020-04-13 13:39:40 -0500298diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
299index e8398cbde5ba..ba682ec0c9e7 100644
300--- a/src/shared/cgroup-setup.c
301+++ b/src/shared/cgroup-setup.c
302@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
303
304 xsprintf(c, PID_FMT "\n", pid);
305
306- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
307+ r = write_string_file(fs, c, 0);
308 if (r < 0)
309 return r;
310
311@@ -817,7 +817,7 @@ int cg_enable_everywhere(
312 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
313 }
314
315- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
316+ r = write_string_stream(f, s, 0);
317 if (r < 0) {
318 log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
319 FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
Brad Bishopc342db32019-05-15 21:57:59 -0400320diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500321index 8543dbd2d05f..76162599817e 100644
Brad Bishopc342db32019-05-15 21:57:59 -0400322--- a/src/shared/sysctl-util.c
323+++ b/src/shared/sysctl-util.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500324@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
Brad Bishopc342db32019-05-15 21:57:59 -0400325
326 log_debug("Setting '%s' to '%s'", p, value);
327
328- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
329+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
330 }
331
332 int sysctl_read(const char *property, char **content) {
Brad Bishop19323692019-04-05 15:28:33 -0400333diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500334index fbfddc0262fc..7cc2902154e9 100644
Brad Bishop19323692019-04-05 15:28:33 -0400335--- a/src/sleep/sleep.c
336+++ b/src/sleep/sleep.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500337@@ -47,7 +47,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
338 assert(hibernate_location->swap);
Brad Bishop19323692019-04-05 15:28:33 -0400339
Andrew Geissler82c905d2020-04-13 13:39:40 -0500340 xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
341- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
342+ r = write_string_file("/sys/power/resume", resume_str, 0);
343 if (r < 0)
344 return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
345 hibernate_location->swap->device, resume_str);
346@@ -74,7 +74,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
347 }
Brad Bishop19323692019-04-05 15:28:33 -0400348
Andrew Geissler82c905d2020-04-13 13:39:40 -0500349 xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
Brad Bishop19323692019-04-05 15:28:33 -0400350- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
351+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
352 if (r < 0)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500353 return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
354 hibernate_location->swap->device, offset_str);
355@@ -91,7 +91,7 @@ static int write_mode(char **modes) {
Brad Bishop19323692019-04-05 15:28:33 -0400356 STRV_FOREACH(mode, modes) {
357 int k;
358
359- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
360+ k = write_string_file("/sys/power/disk", *mode, 0);
361 if (k >= 0)
362 return 0;
363
Andrew Geissler82c905d2020-04-13 13:39:40 -0500364@@ -110,7 +110,7 @@ static int write_state(FILE **f, char **states) {
Brad Bishop19323692019-04-05 15:28:33 -0400365 STRV_FOREACH(state, states) {
366 int k;
367
368- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
369+ k = write_string_stream(*f, *state, 0);
370 if (k >= 0)
371 return 0;
372 log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
Brad Bishop19323692019-04-05 15:28:33 -0400373diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500374index 60c68b5029cf..fdca03d3d42c 100644
Brad Bishop19323692019-04-05 15:28:33 -0400375--- a/src/udev/udevadm-trigger.c
376+++ b/src/udev/udevadm-trigger.c
Brad Bishopc342db32019-05-15 21:57:59 -0400377@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set *settle_se
Brad Bishop19323692019-04-05 15:28:33 -0400378 if (!filename)
379 return log_oom();
380
381- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
382+ r = write_string_file(filename, action, 0);
383 if (r < 0) {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500384 bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV, -EROFS);
385
Brad Bishop19323692019-04-05 15:28:33 -0400386diff --git a/src/udev/udevd.c b/src/udev/udevd.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500387index ca65474f2763..38780681431a 100644
Brad Bishop19323692019-04-05 15:28:33 -0400388--- a/src/udev/udevd.c
389+++ b/src/udev/udevd.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500390@@ -1089,7 +1089,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) {
Brad Bishop19323692019-04-05 15:28:33 -0400391
Brad Bishopa34c0302019-09-23 22:34:48 -0400392 filename = strjoina(syspath, "/uevent");
393 log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath);
394- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
395+ r = write_string_file(filename, "change", 0);
396 if (r < 0)
397 return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename);
Brad Bishop19323692019-04-05 15:28:33 -0400398 return 0;
Brad Bishop19323692019-04-05 15:28:33 -0400399diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500400index 9d706085fb47..30dcfa86f4d0 100644
Brad Bishop19323692019-04-05 15:28:33 -0400401--- a/src/vconsole/vconsole-setup.c
402+++ b/src/vconsole/vconsole-setup.c
Andrew Geissler82c905d2020-04-13 13:39:40 -0500403@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
Brad Bishop19323692019-04-05 15:28:33 -0400404 static int toggle_utf8_sysfs(bool utf8) {
405 int r;
406
407- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
408+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
409 if (r < 0)
410 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
411