blob: 2f4daf86658819d821b39689ed8f289dfb48cc74 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 85e3c3046562ec24fc2f09ebfd08bf9f168091d5 Mon Sep 17 00:00:00 2001
2From: 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>
Brad Bishop19323692019-04-05 15:28:33 -040021---
22 src/basic/cgroup-util.c | 14 +++++++-------
23 src/basic/procfs-util.c | 4 ++--
24 src/basic/smack-util.c | 2 +-
25 src/basic/util.c | 2 +-
26 src/binfmt/binfmt.c | 6 +++---
27 src/core/main.c | 4 ++--
28 src/core/smack-setup.c | 8 ++++----
29 src/hibernate-resume/hibernate-resume.c | 2 +-
30 src/libsystemd/sd-device/sd-device.c | 2 +-
31 src/login/logind-dbus.c | 2 +-
Brad Bishop19323692019-04-05 15:28:33 -040032 src/nspawn/nspawn-cgroup.c | 2 +-
33 src/nspawn/nspawn.c | 6 +++---
Brad Bishopc342db32019-05-15 21:57:59 -040034 src/shared/sysctl-util.c | 2 +-
Brad Bishopa34c0302019-09-23 22:34:48 -040035 src/sleep/sleep.c | 10 +++++-----
Brad Bishop19323692019-04-05 15:28:33 -040036 src/udev/udevadm-trigger.c | 2 +-
Brad Bishopa34c0302019-09-23 22:34:48 -040037 src/udev/udevd.c | 2 +-
Brad Bishop19323692019-04-05 15:28:33 -040038 src/vconsole/vconsole-setup.c | 2 +-
Brad Bishopa34c0302019-09-23 22:34:48 -040039 17 files changed, 36 insertions(+), 36 deletions(-)
Brad Bishop19323692019-04-05 15:28:33 -040040
41diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
Brad Bishopa34c0302019-09-23 22:34:48 -040042index 7b5839ccd6..18f6e8ffc8 100644
Brad Bishop19323692019-04-05 15:28:33 -040043--- a/src/basic/cgroup-util.c
44+++ b/src/basic/cgroup-util.c
Brad Bishopa34c0302019-09-23 22:34:48 -040045@@ -860,7 +860,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
Brad Bishop19323692019-04-05 15:28:33 -040046
47 xsprintf(c, PID_FMT "\n", pid);
48
49- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
50+ r = write_string_file(fs, c, 0);
51 if (r < 0)
52 return r;
53
Brad Bishopa34c0302019-09-23 22:34:48 -040054@@ -1142,7 +1142,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
Brad Bishop19323692019-04-05 15:28:33 -040055
56 sc = strstrip(contents);
57 if (isempty(sc)) {
58- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
59+ r = write_string_file(fs, agent, 0);
60 if (r < 0)
61 return r;
62 } else if (!path_equal(sc, agent))
Brad Bishopa34c0302019-09-23 22:34:48 -040063@@ -1160,7 +1160,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
Brad Bishop19323692019-04-05 15:28:33 -040064
65 sc = strstrip(contents);
66 if (streq(sc, "0")) {
67- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
68+ r = write_string_file(fs, "1", 0);
69 if (r < 0)
70 return r;
71
Brad Bishopa34c0302019-09-23 22:34:48 -040072@@ -1187,7 +1187,7 @@ int cg_uninstall_release_agent(const char *controller) {
Brad Bishop19323692019-04-05 15:28:33 -040073 if (r < 0)
74 return r;
75
76- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
77+ r = write_string_file(fs, "0", 0);
78 if (r < 0)
79 return r;
80
Brad Bishopa34c0302019-09-23 22:34:48 -040081@@ -1197,7 +1197,7 @@ int cg_uninstall_release_agent(const char *controller) {
Brad Bishop19323692019-04-05 15:28:33 -040082 if (r < 0)
83 return r;
84
85- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
86+ r = write_string_file(fs, "", 0);
87 if (r < 0)
88 return r;
89
Brad Bishopa34c0302019-09-23 22:34:48 -040090@@ -2053,7 +2053,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
Brad Bishop19323692019-04-05 15:28:33 -040091 if (r < 0)
92 return r;
93
94- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
95+ return write_string_file(p, value, 0);
96 }
97
98 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
Brad Bishopa34c0302019-09-23 22:34:48 -040099@@ -2697,7 +2697,7 @@ int cg_enable_everywhere(
Brad Bishop19323692019-04-05 15:28:33 -0400100 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
101 }
102
103- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
104+ r = write_string_stream(f, s, 0);
105 if (r < 0) {
106 log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
107 FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
108diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400109index 42ce53d5aa..57512532a6 100644
Brad Bishop19323692019-04-05 15:28:33 -0400110--- a/src/basic/procfs-util.c
111+++ b/src/basic/procfs-util.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400112@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
Brad Bishop19323692019-04-05 15:28:33 -0400113 * decrease it, as threads-max is the much more relevant sysctl. */
114 if (limit > pid_max-1) {
115 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
116- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
117+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
118 if (r < 0)
119 return r;
120 }
121
122 sprintf(buffer, "%" PRIu64, limit);
123- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
124+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
125 if (r < 0) {
126 uint64_t threads_max;
127
128diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400129index 123d00e13e..e7ea78f349 100644
Brad Bishop19323692019-04-05 15:28:33 -0400130--- a/src/basic/smack-util.c
131+++ b/src/basic/smack-util.c
132@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
133 return 0;
134
135 p = procfs_file_alloca(pid, "attr/current");
136- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
137+ r = write_string_file(p, label, 0);
138 if (r < 0)
139 return r;
140
141diff --git a/src/basic/util.c b/src/basic/util.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400142index 93d610bc98..97dca64f73 100644
Brad Bishop19323692019-04-05 15:28:33 -0400143--- a/src/basic/util.c
144+++ b/src/basic/util.c
Brad Bishopc342db32019-05-15 21:57:59 -0400145@@ -294,7 +294,7 @@ void disable_coredumps(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400146 if (detect_container() > 0)
147 return;
148
149- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
150+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
151 if (r < 0)
152 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
153 }
154diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400155index aa9d811f2e..8c7f2dae7a 100644
Brad Bishop19323692019-04-05 15:28:33 -0400156--- a/src/binfmt/binfmt.c
157+++ b/src/binfmt/binfmt.c
Brad Bishopc342db32019-05-15 21:57:59 -0400158@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) {
Brad Bishop19323692019-04-05 15:28:33 -0400159 if (!fn)
160 return log_oom();
161
162- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
163+ return write_string_file(fn, "-1", 0);
164 }
165
166 static int apply_rule(const char *rule) {
Brad Bishopc342db32019-05-15 21:57:59 -0400167@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) {
Brad Bishop19323692019-04-05 15:28:33 -0400168
169 (void) delete_rule(rule);
170
171- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
172+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
173 if (r < 0)
174 return log_error_errno(r, "Failed to add binary format: %m");
175
Brad Bishopc342db32019-05-15 21:57:59 -0400176@@ -213,7 +213,7 @@ static int run(int argc, char *argv[]) {
Brad Bishop19323692019-04-05 15:28:33 -0400177 }
178
179 /* Flush out all rules */
Brad Bishopa34c0302019-09-23 22:34:48 -0400180- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
181+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
Brad Bishop19323692019-04-05 15:28:33 -0400182
183 STRV_FOREACH(f, files) {
184 k = apply_file(*f, true);
185diff --git a/src/core/main.c b/src/core/main.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400186index bcce7178a8..4199cedab9 100644
Brad Bishop19323692019-04-05 15:28:33 -0400187--- a/src/core/main.c
188+++ b/src/core/main.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400189@@ -1285,7 +1285,7 @@ static int bump_unix_max_dgram_qlen(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400190 if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
191 return 0;
192
193- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
194+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
195 if (r < 0)
196 return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
197 "Failed to bump AF_UNIX datagram queue length, ignoring: %m");
Brad Bishopa34c0302019-09-23 22:34:48 -0400198@@ -1509,7 +1509,7 @@ static void initialize_core_pattern(bool skip_setup) {
Brad Bishop19323692019-04-05 15:28:33 -0400199 if (getpid_cached() != 1)
200 return;
201
202- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
203+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
204 if (r < 0)
205 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
206 }
207diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400208index b95e6239d4..fdbdaaaccb 100644
Brad Bishop19323692019-04-05 15:28:33 -0400209--- a/src/core/smack-setup.c
210+++ b/src/core/smack-setup.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400211@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) {
Brad Bishop19323692019-04-05 15:28:33 -0400212 }
213
214 #ifdef SMACK_RUN_LABEL
215- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
216+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
217 if (r < 0)
218 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
219- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
220+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
221 if (r < 0)
222 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
223 r = write_string_file("/sys/fs/smackfs/netlabel",
224- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
225+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
226 if (r < 0)
227 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
228- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
229+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
230 if (r < 0)
231 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
232 #endif
233diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400234index 17e7cd1a00..87a7667716 100644
Brad Bishop19323692019-04-05 15:28:33 -0400235--- a/src/hibernate-resume/hibernate-resume.c
236+++ b/src/hibernate-resume/hibernate-resume.c
237@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
238 return EXIT_FAILURE;
239 }
240
241- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
242+ r = write_string_file("/sys/power/resume", major_minor, 0);
243 if (r < 0) {
244 log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
245 return EXIT_FAILURE;
246diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400247index c4a7f2f3d3..bcac758284 100644
Brad Bishop19323692019-04-05 15:28:33 -0400248--- a/src/libsystemd/sd-device/sd-device.c
249+++ b/src/libsystemd/sd-device/sd-device.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400250@@ -1849,7 +1849,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
Brad Bishop19323692019-04-05 15:28:33 -0400251 if (!value)
252 return -ENOMEM;
253
254- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
255+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
256 if (r < 0) {
257 if (r == -ELOOP)
258 return -EINVAL;
259diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400260index 30b9a66334..cc1d577933 100644
Brad Bishop19323692019-04-05 15:28:33 -0400261--- a/src/login/logind-dbus.c
262+++ b/src/login/logind-dbus.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400263@@ -1325,7 +1325,7 @@ static int trigger_device(Manager *m, sd_device *d) {
Brad Bishop19323692019-04-05 15:28:33 -0400264 if (!t)
265 return -ENOMEM;
266
267- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
268+ (void) write_string_file(t, "change", 0);
269 }
270
271 return 0;
Brad Bishop19323692019-04-05 15:28:33 -0400272diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400273index 0462b46413..7c53d41483 100644
Brad Bishop19323692019-04-05 15:28:33 -0400274--- a/src/nspawn/nspawn-cgroup.c
275+++ b/src/nspawn/nspawn-cgroup.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400276@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
277 fn = strjoina(tree, cgroup, "/cgroup.procs");
Brad Bishop19323692019-04-05 15:28:33 -0400278
279 sprintf(pid_string, PID_FMT, pid);
Brad Bishopa34c0302019-09-23 22:34:48 -0400280- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
281+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
Brad Bishop19323692019-04-05 15:28:33 -0400282 if (r < 0) {
283 log_error_errno(r, "Failed to move process: %m");
284 goto finish;
285diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400286index 2aec8041f0..841542f2f3 100644
Brad Bishop19323692019-04-05 15:28:33 -0400287--- a/src/nspawn/nspawn.c
288+++ b/src/nspawn/nspawn.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400289@@ -2357,7 +2357,7 @@ static int reset_audit_loginuid(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400290 if (streq(p, "4294967295"))
291 return 0;
292
293- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
294+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
295 if (r < 0) {
296 log_error_errno(r,
297 "Failed to reset audit login UID. This probably means that your kernel is too\n"
Brad Bishopa34c0302019-09-23 22:34:48 -0400298@@ -3566,13 +3566,13 @@ static int setup_uid_map(pid_t pid) {
Brad Bishop19323692019-04-05 15:28:33 -0400299
300 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
301 xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range);
302- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
303+ r = write_string_file(uid_map, line, 0);
304 if (r < 0)
305 return log_error_errno(r, "Failed to write UID map: %m");
306
307 /* We always assign the same UID and GID ranges */
308 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
309- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
310+ r = write_string_file(uid_map, line, 0);
311 if (r < 0)
312 return log_error_errno(r, "Failed to write GID map: %m");
313
Brad Bishopc342db32019-05-15 21:57:59 -0400314diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400315index 93bdcf11bf..68cddb7a9f 100644
Brad Bishopc342db32019-05-15 21:57:59 -0400316--- a/src/shared/sysctl-util.c
317+++ b/src/shared/sysctl-util.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400318@@ -88,7 +88,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
Brad Bishopc342db32019-05-15 21:57:59 -0400319
320 log_debug("Setting '%s' to '%s'", p, value);
321
322- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
323+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
324 }
325
326 int sysctl_read(const char *property, char **content) {
Brad Bishop19323692019-04-05 15:28:33 -0400327diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400328index b9fe96635d..f168d7f890 100644
Brad Bishop19323692019-04-05 15:28:33 -0400329--- a/src/sleep/sleep.c
330+++ b/src/sleep/sleep.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400331@@ -54,7 +54,7 @@ static int write_hibernate_location_info(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400332
333 /* if it's a swap partition, we just write the disk to /sys/power/resume */
334 if (streq(type, "partition")) {
335- r = write_string_file("/sys/power/resume", device, WRITE_STRING_FILE_DISABLE_BUFFER);
336+ r = write_string_file("/sys/power/resume", device, 0);
337 if (r < 0)
Brad Bishopa34c0302019-09-23 22:34:48 -0400338 return log_debug_errno(r, "Failed to write partition device to /sys/power/resume: %m");
Brad Bishop19323692019-04-05 15:28:33 -0400339
Brad Bishopa34c0302019-09-23 22:34:48 -0400340@@ -98,14 +98,14 @@ static int write_hibernate_location_info(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400341
342 offset = fiemap->fm_extents[0].fe_physical / page_size();
343 xsprintf(offset_str, "%" PRIu64, offset);
344- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
345+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
346 if (r < 0)
347 return log_debug_errno(r, "Failed to write offset '%s': %m", offset_str);
348
Brad Bishopa34c0302019-09-23 22:34:48 -0400349 log_debug("Wrote calculated resume_offset value to /sys/power/resume_offset: %s", offset_str);
350
Brad Bishop19323692019-04-05 15:28:33 -0400351 xsprintf(device_str, "%lx", (unsigned long)stb.st_dev);
352- r = write_string_file("/sys/power/resume", device_str, WRITE_STRING_FILE_DISABLE_BUFFER);
353+ r = write_string_file("/sys/power/resume", device_str, 0);
354 if (r < 0)
355 return log_debug_errno(r, "Failed to write device '%s': %m", device_str);
356
Brad Bishopa34c0302019-09-23 22:34:48 -0400357@@ -121,7 +121,7 @@ static int write_mode(char **modes) {
Brad Bishop19323692019-04-05 15:28:33 -0400358 STRV_FOREACH(mode, modes) {
359 int k;
360
361- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
362+ k = write_string_file("/sys/power/disk", *mode, 0);
363 if (k >= 0)
364 return 0;
365
Brad Bishopa34c0302019-09-23 22:34:48 -0400366@@ -140,7 +140,7 @@ static int write_state(FILE **f, char **states) {
Brad Bishop19323692019-04-05 15:28:33 -0400367 STRV_FOREACH(state, states) {
368 int k;
369
370- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
371+ k = write_string_stream(*f, *state, 0);
372 if (k >= 0)
373 return 0;
374 log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
Brad Bishop19323692019-04-05 15:28:33 -0400375diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400376index 77d95e513f..25ce4abfb1 100644
Brad Bishop19323692019-04-05 15:28:33 -0400377--- a/src/udev/udevadm-trigger.c
378+++ b/src/udev/udevadm-trigger.c
Brad Bishopc342db32019-05-15 21:57:59 -0400379@@ -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 -0400380 if (!filename)
381 return log_oom();
382
383- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
384+ r = write_string_file(filename, action, 0);
385 if (r < 0) {
Brad Bishopa34c0302019-09-23 22:34:48 -0400386 log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_ERR, r,
387 "Failed to write '%s' to '%s': %m", action, filename);
Brad Bishop19323692019-04-05 15:28:33 -0400388diff --git a/src/udev/udevd.c b/src/udev/udevd.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400389index cb5123042a..ea309a9e7f 100644
Brad Bishop19323692019-04-05 15:28:33 -0400390--- a/src/udev/udevd.c
391+++ b/src/udev/udevd.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400392@@ -1113,7 +1113,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) {
Brad Bishop19323692019-04-05 15:28:33 -0400393
Brad Bishopa34c0302019-09-23 22:34:48 -0400394 filename = strjoina(syspath, "/uevent");
395 log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath);
396- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
397+ r = write_string_file(filename, "change", 0);
398 if (r < 0)
399 return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename);
Brad Bishop19323692019-04-05 15:28:33 -0400400 return 0;
Brad Bishop19323692019-04-05 15:28:33 -0400401diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400402index 75d052ae70..5a15c939d8 100644
Brad Bishop19323692019-04-05 15:28:33 -0400403--- a/src/vconsole/vconsole-setup.c
404+++ b/src/vconsole/vconsole-setup.c
Brad Bishopa34c0302019-09-23 22:34:48 -0400405@@ -117,7 +117,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
Brad Bishop19323692019-04-05 15:28:33 -0400406 static int toggle_utf8_sysfs(bool utf8) {
407 int r;
408
409- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
410+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
411 if (r < 0)
412 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
413