blob: 68ca604d6d3e1ad9b4536eebc763ef1876b5adb2 [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 Bishop19323692019-04-05 15:28:33 -040019---
20 src/basic/cgroup-util.c | 14 +++++++-------
21 src/basic/procfs-util.c | 4 ++--
22 src/basic/smack-util.c | 2 +-
23 src/basic/util.c | 2 +-
24 src/binfmt/binfmt.c | 6 +++---
25 src/core/main.c | 4 ++--
26 src/core/smack-setup.c | 8 ++++----
27 src/hibernate-resume/hibernate-resume.c | 2 +-
28 src/libsystemd/sd-device/sd-device.c | 2 +-
29 src/login/logind-dbus.c | 2 +-
Brad Bishop19323692019-04-05 15:28:33 -040030 src/nspawn/nspawn-cgroup.c | 2 +-
31 src/nspawn/nspawn.c | 6 +++---
Brad Bishopc342db32019-05-15 21:57:59 -040032 src/shared/sysctl-util.c | 2 +-
Brad Bishop19323692019-04-05 15:28:33 -040033 src/sleep/sleep.c | 12 ++++++------
34 src/udev/udevadm-trigger.c | 2 +-
35 src/udev/udevd.c | 6 +++---
36 src/vconsole/vconsole-setup.c | 2 +-
Brad Bishopc342db32019-05-15 21:57:59 -040037 17 files changed, 39 insertions(+), 39 deletions(-)
Brad Bishop19323692019-04-05 15:28:33 -040038
39diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
Brad Bishopc342db32019-05-15 21:57:59 -040040index fc28109..44fe985 100644
Brad Bishop19323692019-04-05 15:28:33 -040041--- a/src/basic/cgroup-util.c
42+++ b/src/basic/cgroup-util.c
Brad Bishopc342db32019-05-15 21:57:59 -040043@@ -822,7 +822,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
Brad Bishop19323692019-04-05 15:28:33 -040044
45 xsprintf(c, PID_FMT "\n", pid);
46
47- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
48+ r = write_string_file(fs, c, 0);
49 if (r < 0)
50 return r;
51
Brad Bishopc342db32019-05-15 21:57:59 -040052@@ -1104,7 +1104,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
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))
Brad Bishopc342db32019-05-15 21:57:59 -040061@@ -1122,7 +1122,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
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
Brad Bishopc342db32019-05-15 21:57:59 -040070@@ -1149,7 +1149,7 @@ int cg_uninstall_release_agent(const char *controller) {
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
Brad Bishopc342db32019-05-15 21:57:59 -040079@@ -1159,7 +1159,7 @@ int cg_uninstall_release_agent(const char *controller) {
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
Brad Bishopc342db32019-05-15 21:57:59 -040088@@ -2016,7 +2016,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
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) {
Brad Bishopc342db32019-05-15 21:57:59 -040097@@ -2664,7 +2664,7 @@ int cg_enable_everywhere(
Brad Bishop19323692019-04-05 15:28:33 -040098 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
99 }
100
101- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
102+ r = write_string_stream(f, s, 0);
103 if (r < 0) {
104 log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
105 FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
106diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
Brad Bishopc342db32019-05-15 21:57:59 -0400107index 7aaf95b..25fc3de 100644
Brad Bishop19323692019-04-05 15:28:33 -0400108--- a/src/basic/procfs-util.c
109+++ b/src/basic/procfs-util.c
Brad Bishopc342db32019-05-15 21:57:59 -0400110@@ -85,13 +85,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
Brad Bishop19323692019-04-05 15:28:33 -0400111 * decrease it, as threads-max is the much more relevant sysctl. */
112 if (limit > pid_max-1) {
113 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
114- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
115+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
116 if (r < 0)
117 return r;
118 }
119
120 sprintf(buffer, "%" PRIu64, limit);
121- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
122+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
123 if (r < 0) {
124 uint64_t threads_max;
125
126diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
127index 123d00e..e7ea78f 100644
128--- a/src/basic/smack-util.c
129+++ b/src/basic/smack-util.c
130@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
131 return 0;
132
133 p = procfs_file_alloca(pid, "attr/current");
134- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
135+ r = write_string_file(p, label, 0);
136 if (r < 0)
137 return r;
138
139diff --git a/src/basic/util.c b/src/basic/util.c
Brad Bishopc342db32019-05-15 21:57:59 -0400140index 93d610b..97dca64 100644
Brad Bishop19323692019-04-05 15:28:33 -0400141--- a/src/basic/util.c
142+++ b/src/basic/util.c
Brad Bishopc342db32019-05-15 21:57:59 -0400143@@ -294,7 +294,7 @@ void disable_coredumps(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400144 if (detect_container() > 0)
145 return;
146
147- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
148+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
149 if (r < 0)
150 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
151 }
152diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
Brad Bishopc342db32019-05-15 21:57:59 -0400153index 66e2f01..5daa43b 100644
Brad Bishop19323692019-04-05 15:28:33 -0400154--- a/src/binfmt/binfmt.c
155+++ b/src/binfmt/binfmt.c
Brad Bishopc342db32019-05-15 21:57:59 -0400156@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) {
Brad Bishop19323692019-04-05 15:28:33 -0400157 if (!fn)
158 return log_oom();
159
160- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
161+ return write_string_file(fn, "-1", 0);
162 }
163
164 static int apply_rule(const char *rule) {
Brad Bishopc342db32019-05-15 21:57:59 -0400165@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) {
Brad Bishop19323692019-04-05 15:28:33 -0400166
167 (void) delete_rule(rule);
168
169- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
170+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
171 if (r < 0)
172 return log_error_errno(r, "Failed to add binary format: %m");
173
Brad Bishopc342db32019-05-15 21:57:59 -0400174@@ -213,7 +213,7 @@ static int run(int argc, char *argv[]) {
Brad Bishop19323692019-04-05 15:28:33 -0400175 }
176
177 /* Flush out all rules */
178- write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
179+ write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
180
181 STRV_FOREACH(f, files) {
182 k = apply_file(*f, true);
183diff --git a/src/core/main.c b/src/core/main.c
Brad Bishopc342db32019-05-15 21:57:59 -0400184index 46db471..726ccaf 100644
Brad Bishop19323692019-04-05 15:28:33 -0400185--- a/src/core/main.c
186+++ b/src/core/main.c
Brad Bishopc342db32019-05-15 21:57:59 -0400187@@ -1469,7 +1469,7 @@ static int bump_unix_max_dgram_qlen(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400188 if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
189 return 0;
190
191- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
192+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
193 if (r < 0)
194 return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
195 "Failed to bump AF_UNIX datagram queue length, ignoring: %m");
Brad Bishopc342db32019-05-15 21:57:59 -0400196@@ -1684,7 +1684,7 @@ static void initialize_core_pattern(bool skip_setup) {
Brad Bishop19323692019-04-05 15:28:33 -0400197 if (getpid_cached() != 1)
198 return;
199
200- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
201+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
202 if (r < 0)
203 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
204 }
205diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
Brad Bishopc342db32019-05-15 21:57:59 -0400206index cd7fb01..077e861 100644
Brad Bishop19323692019-04-05 15:28:33 -0400207--- a/src/core/smack-setup.c
208+++ b/src/core/smack-setup.c
Brad Bishopc342db32019-05-15 21:57:59 -0400209@@ -351,17 +351,17 @@ int mac_smack_setup(bool *loaded_policy) {
Brad Bishop19323692019-04-05 15:28:33 -0400210 }
211
212 #ifdef SMACK_RUN_LABEL
213- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
214+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
215 if (r < 0)
216 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
217- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
218+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
219 if (r < 0)
220 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
221 r = write_string_file("/sys/fs/smackfs/netlabel",
222- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
223+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
224 if (r < 0)
225 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
226- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
227+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
228 if (r < 0)
229 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
230 #endif
231diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
232index 17e7cd1..87a7667 100644
233--- a/src/hibernate-resume/hibernate-resume.c
234+++ b/src/hibernate-resume/hibernate-resume.c
235@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
236 return EXIT_FAILURE;
237 }
238
239- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
240+ r = write_string_file("/sys/power/resume", major_minor, 0);
241 if (r < 0) {
242 log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
243 return EXIT_FAILURE;
244diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
Brad Bishopc342db32019-05-15 21:57:59 -0400245index c2315c0..00f81b4 100644
Brad Bishop19323692019-04-05 15:28:33 -0400246--- a/src/libsystemd/sd-device/sd-device.c
247+++ b/src/libsystemd/sd-device/sd-device.c
Brad Bishopc342db32019-05-15 21:57:59 -0400248@@ -1852,7 +1852,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
Brad Bishop19323692019-04-05 15:28:33 -0400249 if (!value)
250 return -ENOMEM;
251
252- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
253+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
254 if (r < 0) {
255 if (r == -ELOOP)
256 return -EINVAL;
257diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
Brad Bishopc342db32019-05-15 21:57:59 -0400258index 2cebcce..7111fc1 100644
Brad Bishop19323692019-04-05 15:28:33 -0400259--- a/src/login/logind-dbus.c
260+++ b/src/login/logind-dbus.c
Brad Bishopc342db32019-05-15 21:57:59 -0400261@@ -1285,7 +1285,7 @@ static int trigger_device(Manager *m, sd_device *d) {
Brad Bishop19323692019-04-05 15:28:33 -0400262 if (!t)
263 return -ENOMEM;
264
265- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
266+ (void) write_string_file(t, "change", 0);
267 }
268
269 return 0;
Brad Bishop19323692019-04-05 15:28:33 -0400270diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
Brad Bishopc342db32019-05-15 21:57:59 -0400271index 168125d..dd0ab79 100644
Brad Bishop19323692019-04-05 15:28:33 -0400272--- a/src/nspawn/nspawn-cgroup.c
273+++ b/src/nspawn/nspawn-cgroup.c
Brad Bishopc342db32019-05-15 21:57:59 -0400274@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
Brad Bishop19323692019-04-05 15:28:33 -0400275 (void) mkdir_parents(fn, 0755);
276
277 sprintf(pid_string, PID_FMT, pid);
278- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER);
279+ r = write_string_file(fn, pid_string, 0);
280 if (r < 0) {
281 log_error_errno(r, "Failed to move process: %m");
282 goto finish;
283diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
Brad Bishopc342db32019-05-15 21:57:59 -0400284index 3b0ecb1..a1b5240 100644
Brad Bishop19323692019-04-05 15:28:33 -0400285--- a/src/nspawn/nspawn.c
286+++ b/src/nspawn/nspawn.c
Brad Bishopc342db32019-05-15 21:57:59 -0400287@@ -2341,7 +2341,7 @@ static int reset_audit_loginuid(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400288 if (streq(p, "4294967295"))
289 return 0;
290
291- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
292+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
293 if (r < 0) {
294 log_error_errno(r,
295 "Failed to reset audit login UID. This probably means that your kernel is too\n"
Brad Bishopc342db32019-05-15 21:57:59 -0400296@@ -3531,13 +3531,13 @@ static int setup_uid_map(pid_t pid) {
Brad Bishop19323692019-04-05 15:28:33 -0400297
298 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
299 xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range);
300- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
301+ r = write_string_file(uid_map, line, 0);
302 if (r < 0)
303 return log_error_errno(r, "Failed to write UID map: %m");
304
305 /* We always assign the same UID and GID ranges */
306 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
307- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
308+ r = write_string_file(uid_map, line, 0);
309 if (r < 0)
310 return log_error_errno(r, "Failed to write GID map: %m");
311
Brad Bishopc342db32019-05-15 21:57:59 -0400312diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
313index 9be4055..f935cde 100644
314--- a/src/shared/sysctl-util.c
315+++ b/src/shared/sysctl-util.c
316@@ -73,7 +73,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
317
318 log_debug("Setting '%s' to '%s'", p, value);
319
320- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
321+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
322 }
323
324 int sysctl_read(const char *property, char **content) {
Brad Bishop19323692019-04-05 15:28:33 -0400325diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
Brad Bishopc342db32019-05-15 21:57:59 -0400326index 11aabaf..6aa5d37 100644
Brad Bishop19323692019-04-05 15:28:33 -0400327--- a/src/sleep/sleep.c
328+++ b/src/sleep/sleep.c
Brad Bishopc342db32019-05-15 21:57:59 -0400329@@ -48,7 +48,7 @@ static int write_hibernate_location_info(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400330
331 /* if it's a swap partition, we just write the disk to /sys/power/resume */
332 if (streq(type, "partition")) {
333- r = write_string_file("/sys/power/resume", device, WRITE_STRING_FILE_DISABLE_BUFFER);
334+ r = write_string_file("/sys/power/resume", device, 0);
335 if (r < 0)
336 return log_debug_errno(r, "Faileed to write partitoin device to /sys/power/resume: %m");
337
Brad Bishopc342db32019-05-15 21:57:59 -0400338@@ -84,12 +84,12 @@ static int write_hibernate_location_info(void) {
Brad Bishop19323692019-04-05 15:28:33 -0400339
340 offset = fiemap->fm_extents[0].fe_physical / page_size();
341 xsprintf(offset_str, "%" PRIu64, offset);
342- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
343+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
344 if (r < 0)
345 return log_debug_errno(r, "Failed to write offset '%s': %m", offset_str);
346
347 xsprintf(device_str, "%lx", (unsigned long)stb.st_dev);
348- r = write_string_file("/sys/power/resume", device_str, WRITE_STRING_FILE_DISABLE_BUFFER);
349+ r = write_string_file("/sys/power/resume", device_str, 0);
350 if (r < 0)
351 return log_debug_errno(r, "Failed to write device '%s': %m", device_str);
352
Brad Bishopc342db32019-05-15 21:57:59 -0400353@@ -103,7 +103,7 @@ static int write_mode(char **modes) {
Brad Bishop19323692019-04-05 15:28:33 -0400354 STRV_FOREACH(mode, modes) {
355 int k;
356
357- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
358+ k = write_string_file("/sys/power/disk", *mode, 0);
359 if (k >= 0)
360 return 0;
361
Brad Bishopc342db32019-05-15 21:57:59 -0400362@@ -122,7 +122,7 @@ static int write_state(FILE **f, char **states) {
Brad Bishop19323692019-04-05 15:28:33 -0400363 STRV_FOREACH(state, states) {
364 int k;
365
366- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
367+ k = write_string_stream(*f, *state, 0);
368 if (k >= 0)
369 return 0;
370 log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
Brad Bishopc342db32019-05-15 21:57:59 -0400371@@ -217,7 +217,7 @@ static int rtc_write_wake_alarm(uint64_t sec) {
Brad Bishop19323692019-04-05 15:28:33 -0400372
373 xsprintf(buf, "%" PRIu64, sec);
374
375- r = write_string_file("/sys/class/rtc/rtc0/wakealarm", buf, WRITE_STRING_FILE_DISABLE_BUFFER);
376+ r = write_string_file("/sys/class/rtc/rtc0/wakealarm", buf, 0);
377 if (r < 0)
378 return log_error_errno(r, "Failed to write '%s' to /sys/class/rtc/rtc0/wakealarm: %m", buf);
379
380diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
Brad Bishopc342db32019-05-15 21:57:59 -0400381index b7dafb7..bab4907 100644
Brad Bishop19323692019-04-05 15:28:33 -0400382--- a/src/udev/udevadm-trigger.c
383+++ b/src/udev/udevadm-trigger.c
Brad Bishopc342db32019-05-15 21:57:59 -0400384@@ -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 -0400385 if (!filename)
386 return log_oom();
387
388- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
389+ r = write_string_file(filename, action, 0);
390 if (r < 0) {
391 log_debug_errno(r, "Failed to write '%s' to '%s', ignoring: %m", action, filename);
392 continue;
393diff --git a/src/udev/udevd.c b/src/udev/udevd.c
Brad Bishopc342db32019-05-15 21:57:59 -0400394index 140ec35..33063a9 100644
Brad Bishop19323692019-04-05 15:28:33 -0400395--- a/src/udev/udevd.c
396+++ b/src/udev/udevd.c
Brad Bishopc342db32019-05-15 21:57:59 -0400397@@ -1185,7 +1185,7 @@ static int synthesize_change(sd_device *dev) {
Brad Bishop19323692019-04-05 15:28:33 -0400398 */
399 log_debug("Device '%s' is closed, synthesising 'change'", devname);
400 strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL);
401- write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
402+ write_string_file(filename, "change", 0);
403
404 FOREACH_DEVICE(e, d) {
405 const char *t, *n, *s;
Brad Bishopc342db32019-05-15 21:57:59 -0400406@@ -1200,7 +1200,7 @@ static int synthesize_change(sd_device *dev) {
Brad Bishop19323692019-04-05 15:28:33 -0400407
408 log_debug("Device '%s' is closed, synthesising partition '%s' 'change'", devname, n);
409 strscpyl(filename, sizeof(filename), s, "/uevent", NULL);
410- write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
411+ write_string_file(filename, "change", 0);
412 }
413
414 return 0;
Brad Bishopc342db32019-05-15 21:57:59 -0400415@@ -1208,7 +1208,7 @@ static int synthesize_change(sd_device *dev) {
Brad Bishop19323692019-04-05 15:28:33 -0400416
417 log_debug("Device %s is closed, synthesising 'change'", devname);
418 strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL);
419- write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
420+ write_string_file(filename, "change", 0);
421
422 return 0;
423 }
424diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
Brad Bishopc342db32019-05-15 21:57:59 -0400425index 67dc2e4..01b83d0 100644
Brad Bishop19323692019-04-05 15:28:33 -0400426--- a/src/vconsole/vconsole-setup.c
427+++ b/src/vconsole/vconsole-setup.c
Brad Bishopc342db32019-05-15 21:57:59 -0400428@@ -116,7 +116,7 @@ static int toggle_utf8(const char *name, int fd, bool utf8) {
Brad Bishop19323692019-04-05 15:28:33 -0400429 static int toggle_utf8_sysfs(bool utf8) {
430 int r;
431
432- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
433+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
434 if (r < 0)
435 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
436
437--
Brad Bishopc342db32019-05-15 21:57:59 -04004382.11.0
Brad Bishop19323692019-04-05 15:28:33 -0400439