diff options
Diffstat (limited to 'meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0012-do-not-disable-buffer-in-writing-files.patch')
-rw-r--r-- | meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0012-do-not-disable-buffer-in-writing-files.patch | 562 |
1 files changed, 562 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0012-do-not-disable-buffer-in-writing-files.patch b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0012-do-not-disable-buffer-in-writing-files.patch new file mode 100644 index 000000000..66be79077 --- /dev/null +++ b/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0012-do-not-disable-buffer-in-writing-files.patch | |||
@@ -0,0 +1,562 @@ | |||
1 | From e4885a8e60f883d9217e26e1db3754c2906aca31 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Fri, 1 Mar 2019 15:22:15 +0800 | ||
4 | Subject: [PATCH 12/22] do not disable buffer in writing files | ||
5 | |||
6 | Do not disable buffer in writing files, otherwise we get | ||
7 | failure at boot for musl like below. | ||
8 | |||
9 | [!!!!!!] Failed to allocate manager object. | ||
10 | |||
11 | And there will be other failures, critical or not critical. | ||
12 | This is specific to musl. | ||
13 | |||
14 | Upstream-Status: Inappropriate [musl] | ||
15 | |||
16 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
17 | [Rebased for v242] | ||
18 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> | ||
19 | [rebased for systemd 243] | ||
20 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
21 | [rebased for systemd 254] | ||
22 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
23 | [rebased for systemd 255.1] | ||
24 | --- | ||
25 | src/basic/cgroup-util.c | 12 ++++++------ | ||
26 | src/basic/namespace-util.c | 4 ++-- | ||
27 | src/basic/procfs-util.c | 4 ++-- | ||
28 | src/basic/sysctl-util.c | 2 +- | ||
29 | src/binfmt/binfmt.c | 6 +++--- | ||
30 | src/core/cgroup.c | 2 +- | ||
31 | src/core/main.c | 2 +- | ||
32 | src/core/smack-setup.c | 8 ++++---- | ||
33 | src/home/homework.c | 2 +- | ||
34 | src/libsystemd/sd-device/sd-device.c | 2 +- | ||
35 | src/nspawn/nspawn-cgroup.c | 2 +- | ||
36 | src/nspawn/nspawn.c | 6 +++--- | ||
37 | src/shared/binfmt-util.c | 2 +- | ||
38 | src/shared/cgroup-setup.c | 4 ++-- | ||
39 | src/shared/coredump-util.c | 4 ++-- | ||
40 | src/shared/hibernate-util.c | 4 ++-- | ||
41 | src/shared/smack-util.c | 2 +- | ||
42 | src/shared/watchdog.c | 2 +- | ||
43 | src/sleep/sleep.c | 4 ++-- | ||
44 | src/storagetm/storagetm.c | 24 ++++++++++++------------ | ||
45 | src/udev/udev-rules.c | 1 - | ||
46 | src/vconsole/vconsole-setup.c | 2 +- | ||
47 | 22 files changed, 50 insertions(+), 51 deletions(-) | ||
48 | |||
49 | diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c | ||
50 | index d2be79622f..e65fecb68d 100644 | ||
51 | --- a/src/basic/cgroup-util.c | ||
52 | +++ b/src/basic/cgroup-util.c | ||
53 | @@ -417,7 +417,7 @@ int cg_kill_kernel_sigkill(const char *path) { | ||
54 | if (r < 0) | ||
55 | return r; | ||
56 | |||
57 | - r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
58 | + r = write_string_file(killfile, "1", 0); | ||
59 | if (r < 0) | ||
60 | return r; | ||
61 | |||
62 | @@ -843,7 +843,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { | ||
63 | |||
64 | sc = strstrip(contents); | ||
65 | if (isempty(sc)) { | ||
66 | - r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
67 | + r = write_string_file(fs, agent, 0); | ||
68 | if (r < 0) | ||
69 | return r; | ||
70 | } else if (!path_equal(sc, agent)) | ||
71 | @@ -861,7 +861,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { | ||
72 | |||
73 | sc = strstrip(contents); | ||
74 | if (streq(sc, "0")) { | ||
75 | - r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
76 | + r = write_string_file(fs, "1", 0); | ||
77 | if (r < 0) | ||
78 | return r; | ||
79 | |||
80 | @@ -888,7 +888,7 @@ int cg_uninstall_release_agent(const char *controller) { | ||
81 | if (r < 0) | ||
82 | return r; | ||
83 | |||
84 | - r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
85 | + r = write_string_file(fs, "0", 0); | ||
86 | if (r < 0) | ||
87 | return r; | ||
88 | |||
89 | @@ -898,7 +898,7 @@ int cg_uninstall_release_agent(const char *controller) { | ||
90 | if (r < 0) | ||
91 | return r; | ||
92 | |||
93 | - r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
94 | + r = write_string_file(fs, "", 0); | ||
95 | if (r < 0) | ||
96 | return r; | ||
97 | |||
98 | @@ -1814,7 +1814,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri | ||
99 | if (r < 0) | ||
100 | return r; | ||
101 | |||
102 | - return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
103 | + return write_string_file(p, value, 0); | ||
104 | } | ||
105 | |||
106 | int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { | ||
107 | diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c | ||
108 | index 2101f617ad..63817bae17 100644 | ||
109 | --- a/src/basic/namespace-util.c | ||
110 | +++ b/src/basic/namespace-util.c | ||
111 | @@ -227,12 +227,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) { | ||
112 | freeze(); | ||
113 | |||
114 | xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); | ||
115 | - r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
116 | + r = write_string_file(path, uid_map, 0); | ||
117 | if (r < 0) | ||
118 | return log_error_errno(r, "Failed to write UID map: %m"); | ||
119 | |||
120 | xsprintf(path, "/proc/" PID_FMT "/gid_map", pid); | ||
121 | - r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
122 | + r = write_string_file(path, gid_map, 0); | ||
123 | if (r < 0) | ||
124 | return log_error_errno(r, "Failed to write GID map: %m"); | ||
125 | |||
126 | diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c | ||
127 | index 6cb0ddf575..247cf9e1d1 100644 | ||
128 | --- a/src/basic/procfs-util.c | ||
129 | +++ b/src/basic/procfs-util.c | ||
130 | @@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limit) { | ||
131 | * decrease it, as threads-max is the much more relevant sysctl. */ | ||
132 | if (limit > pid_max-1) { | ||
133 | sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ | ||
134 | - r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
135 | + r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); | ||
136 | if (r < 0) | ||
137 | return r; | ||
138 | } | ||
139 | |||
140 | sprintf(buffer, "%" PRIu64, limit); | ||
141 | - r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
142 | + r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); | ||
143 | if (r < 0) { | ||
144 | uint64_t threads_max; | ||
145 | |||
146 | diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c | ||
147 | index b66a6622ae..8d1c93008a 100644 | ||
148 | --- a/src/basic/sysctl-util.c | ||
149 | +++ b/src/basic/sysctl-util.c | ||
150 | @@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) { | ||
151 | |||
152 | log_debug("Setting '%s' to '%s'", p, value); | ||
153 | |||
154 | - return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); | ||
155 | + return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); | ||
156 | } | ||
157 | |||
158 | int sysctl_writef(const char *property, const char *format, ...) { | ||
159 | diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c | ||
160 | index d21f3f79ff..258607cc7e 100644 | ||
161 | --- a/src/binfmt/binfmt.c | ||
162 | +++ b/src/binfmt/binfmt.c | ||
163 | @@ -30,7 +30,7 @@ static bool arg_unregister = false; | ||
164 | |||
165 | static int delete_rule(const char *rulename) { | ||
166 | const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename); | ||
167 | - return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
168 | + return write_string_file(fn, "-1", 0); | ||
169 | } | ||
170 | |||
171 | static int apply_rule(const char *filename, unsigned line, const char *rule) { | ||
172 | @@ -58,7 +58,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) { | ||
173 | if (r >= 0) | ||
174 | log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename); | ||
175 | |||
176 | - r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
177 | + r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); | ||
178 | if (r < 0) | ||
179 | return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m", | ||
180 | filename, line, rulename); | ||
181 | @@ -248,7 +248,7 @@ static int run(int argc, char *argv[]) { | ||
182 | return r; | ||
183 | |||
184 | /* Flush out all rules */ | ||
185 | - r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
186 | + r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); | ||
187 | if (r < 0) | ||
188 | log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m"); | ||
189 | else | ||
190 | diff --git a/src/core/cgroup.c b/src/core/cgroup.c | ||
191 | index 61ac4df1a6..ea18970196 100644 | ||
192 | --- a/src/core/cgroup.c | ||
193 | +++ b/src/core/cgroup.c | ||
194 | @@ -4578,7 +4578,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { | ||
195 | u->freezer_state = FREEZER_THAWING; | ||
196 | } | ||
197 | |||
198 | - r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
199 | + r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0); | ||
200 | if (r < 0) | ||
201 | return r; | ||
202 | |||
203 | diff --git a/src/core/main.c b/src/core/main.c | ||
204 | index 3f71cc0947..0e5aec3e9e 100644 | ||
205 | --- a/src/core/main.c | ||
206 | +++ b/src/core/main.c | ||
207 | @@ -1678,7 +1678,7 @@ static void initialize_core_pattern(bool skip_setup) { | ||
208 | if (getpid_cached() != 1) | ||
209 | return; | ||
210 | |||
211 | - r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
212 | + r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); | ||
213 | if (r < 0) | ||
214 | log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", | ||
215 | arg_early_core_pattern); | ||
216 | diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c | ||
217 | index 7ea902b6f9..1aef2988d0 100644 | ||
218 | --- a/src/core/smack-setup.c | ||
219 | +++ b/src/core/smack-setup.c | ||
220 | @@ -321,17 +321,17 @@ int mac_smack_setup(bool *loaded_policy) { | ||
221 | } | ||
222 | |||
223 | #if HAVE_SMACK_RUN_LABEL | ||
224 | - r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
225 | + r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); | ||
226 | if (r < 0) | ||
227 | log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); | ||
228 | - r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
229 | + r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); | ||
230 | if (r < 0) | ||
231 | log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); | ||
232 | r = write_string_file("/sys/fs/smackfs/netlabel", | ||
233 | - "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
234 | + "0.0.0.0/0 " SMACK_RUN_LABEL, 0); | ||
235 | if (r < 0) | ||
236 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); | ||
237 | - r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
238 | + r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); | ||
239 | if (r < 0) | ||
240 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); | ||
241 | #endif | ||
242 | diff --git a/src/home/homework.c b/src/home/homework.c | ||
243 | index 066483e342..5f92dd7064 100644 | ||
244 | --- a/src/home/homework.c | ||
245 | +++ b/src/home/homework.c | ||
246 | @@ -278,7 +278,7 @@ static void drop_caches_now(void) { | ||
247 | * for details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but | ||
248 | * not more. */ | ||
249 | |||
250 | - r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
251 | + r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0); | ||
252 | if (r < 0) | ||
253 | log_warning_errno(r, "Failed to drop caches, ignoring: %m"); | ||
254 | else | ||
255 | diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c | ||
256 | index 2fbc619a34..09d9591e37 100644 | ||
257 | --- a/src/libsystemd/sd-device/sd-device.c | ||
258 | +++ b/src/libsystemd/sd-device/sd-device.c | ||
259 | @@ -2516,7 +2516,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, | ||
260 | if (!value) | ||
261 | return -ENOMEM; | ||
262 | |||
263 | - r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); | ||
264 | + r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); | ||
265 | if (r < 0) { | ||
266 | /* On failure, clear cache entry, as we do not know how it fails. */ | ||
267 | device_remove_cached_sysattr_value(device, sysattr); | ||
268 | diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c | ||
269 | index a5002437c6..b12e6cd9c9 100644 | ||
270 | --- a/src/nspawn/nspawn-cgroup.c | ||
271 | +++ b/src/nspawn/nspawn-cgroup.c | ||
272 | @@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { | ||
273 | fn = strjoina(tree, cgroup, "/cgroup.procs"); | ||
274 | |||
275 | sprintf(pid_string, PID_FMT, pid); | ||
276 | - r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); | ||
277 | + r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); | ||
278 | if (r < 0) { | ||
279 | log_error_errno(r, "Failed to move process: %m"); | ||
280 | goto finish; | ||
281 | diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c | ||
282 | index 6ab604d3dc..bbec6b686c 100644 | ||
283 | --- a/src/nspawn/nspawn.c | ||
284 | +++ b/src/nspawn/nspawn.c | ||
285 | @@ -2688,7 +2688,7 @@ static int reset_audit_loginuid(void) { | ||
286 | if (streq(p, "4294967295")) | ||
287 | return 0; | ||
288 | |||
289 | - r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
290 | + r = write_string_file("/proc/self/loginuid", "4294967295", 0); | ||
291 | if (r < 0) { | ||
292 | log_error_errno(r, | ||
293 | "Failed to reset audit login UID. This probably means that your kernel is too\n" | ||
294 | @@ -4141,7 +4141,7 @@ static int setup_uid_map( | ||
295 | return log_oom(); | ||
296 | |||
297 | xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); | ||
298 | - r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
299 | + r = write_string_file(uid_map, s, 0); | ||
300 | if (r < 0) | ||
301 | return log_error_errno(r, "Failed to write UID map: %m"); | ||
302 | |||
303 | @@ -4151,7 +4151,7 @@ static int setup_uid_map( | ||
304 | return log_oom(); | ||
305 | |||
306 | xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); | ||
307 | - r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
308 | + r = write_string_file(uid_map, s, 0); | ||
309 | if (r < 0) | ||
310 | return log_error_errno(r, "Failed to write GID map: %m"); | ||
311 | |||
312 | diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c | ||
313 | index a26175474b..1413a9c72c 100644 | ||
314 | --- a/src/shared/binfmt-util.c | ||
315 | +++ b/src/shared/binfmt-util.c | ||
316 | @@ -46,7 +46,7 @@ int disable_binfmt(void) { | ||
317 | return 0; | ||
318 | } | ||
319 | |||
320 | - r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
321 | + r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); | ||
322 | if (r < 0) | ||
323 | return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m"); | ||
324 | |||
325 | diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c | ||
326 | index 934a16eaf3..c921ced861 100644 | ||
327 | --- a/src/shared/cgroup-setup.c | ||
328 | +++ b/src/shared/cgroup-setup.c | ||
329 | @@ -351,7 +351,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { | ||
330 | |||
331 | xsprintf(c, PID_FMT "\n", pid); | ||
332 | |||
333 | - r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
334 | + r = write_string_file(fs, c, 0); | ||
335 | if (r == -EOPNOTSUPP && cg_is_threaded(path) > 0) | ||
336 | /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */ | ||
337 | return -EUCLEAN; | ||
338 | @@ -966,7 +966,7 @@ int cg_enable_everywhere( | ||
339 | return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); | ||
340 | } | ||
341 | |||
342 | - r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
343 | + r = write_string_stream(f, s, 0); | ||
344 | if (r < 0) { | ||
345 | log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", | ||
346 | FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); | ||
347 | diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c | ||
348 | index 805503f366..01a7ccb291 100644 | ||
349 | --- a/src/shared/coredump-util.c | ||
350 | +++ b/src/shared/coredump-util.c | ||
351 | @@ -163,7 +163,7 @@ int set_coredump_filter(uint64_t value) { | ||
352 | xsprintf(t, "0x%"PRIx64, value); | ||
353 | |||
354 | return write_string_file("/proc/self/coredump_filter", t, | ||
355 | - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); | ||
356 | + 0); | ||
357 | } | ||
358 | |||
359 | /* Turn off core dumps but only if we're running outside of a container. */ | ||
360 | @@ -173,7 +173,7 @@ void disable_coredumps(void) { | ||
361 | if (detect_container() > 0) | ||
362 | return; | ||
363 | |||
364 | - r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
365 | + r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); | ||
366 | if (r < 0) | ||
367 | log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); | ||
368 | } | ||
369 | diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c | ||
370 | index 3eb13d48f6..d09b901be1 100644 | ||
371 | --- a/src/shared/hibernate-util.c | ||
372 | +++ b/src/shared/hibernate-util.c | ||
373 | @@ -481,7 +481,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { | ||
374 | |||
375 | /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so | ||
376 | * fail gracefully if it doesn't exist and we're only overwriting it with 0. */ | ||
377 | - r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
378 | + r = write_string_file("/sys/power/resume_offset", offset_str, 0); | ||
379 | if (r == -ENOENT) { | ||
380 | if (offset != 0) | ||
381 | return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), | ||
382 | @@ -497,7 +497,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { | ||
383 | log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.", | ||
384 | offset_str, device); | ||
385 | |||
386 | - r = write_string_file("/sys/power/resume", devno_str, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
387 | + r = write_string_file("/sys/power/resume", devno_str, 0); | ||
388 | if (r < 0) | ||
389 | return log_error_errno(r, | ||
390 | "Failed to write device '%s' (%s) to /sys/power/resume: %m", | ||
391 | diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c | ||
392 | index 1f88e724d0..feb18b320a 100644 | ||
393 | --- a/src/shared/smack-util.c | ||
394 | +++ b/src/shared/smack-util.c | ||
395 | @@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { | ||
396 | return 0; | ||
397 | |||
398 | p = procfs_file_alloca(pid, "attr/current"); | ||
399 | - r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
400 | + r = write_string_file(p, label, 0); | ||
401 | if (r < 0) | ||
402 | return r; | ||
403 | |||
404 | diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c | ||
405 | index 4c1a968718..6faf6806a5 100644 | ||
406 | --- a/src/shared/watchdog.c | ||
407 | +++ b/src/shared/watchdog.c | ||
408 | @@ -93,7 +93,7 @@ static int set_pretimeout_governor(const char *governor) { | ||
409 | |||
410 | r = write_string_file(sys_fn, | ||
411 | governor, | ||
412 | - WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); | ||
413 | + WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); | ||
414 | if (r < 0) | ||
415 | return log_error_errno(r, "Failed to set pretimeout_governor to '%s': %m", governor); | ||
416 | |||
417 | diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c | ||
418 | index 21af3e9e52..6d4b84b5d5 100644 | ||
419 | --- a/src/sleep/sleep.c | ||
420 | +++ b/src/sleep/sleep.c | ||
421 | @@ -137,7 +137,7 @@ static int write_state(int fd, char * const *states) { | ||
422 | if (k < 0) | ||
423 | return RET_GATHER(r, k); | ||
424 | |||
425 | - k = write_string_stream(f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
426 | + k = write_string_stream(f, *state, 0); | ||
427 | if (k >= 0) { | ||
428 | log_debug("Using sleep state '%s'.", *state); | ||
429 | return 0; | ||
430 | @@ -155,7 +155,7 @@ static int write_mode(char * const *modes) { | ||
431 | STRV_FOREACH(mode, modes) { | ||
432 | int k; | ||
433 | |||
434 | - k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
435 | + k = write_string_file("/sys/power/disk", *mode, 0); | ||
436 | if (k >= 0) { | ||
437 | log_debug("Using sleep disk mode '%s'.", *mode); | ||
438 | return 0; | ||
439 | diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c | ||
440 | index ae63baaf79..82eeca479a 100644 | ||
441 | --- a/src/storagetm/storagetm.c | ||
442 | +++ b/src/storagetm/storagetm.c | ||
443 | @@ -186,7 +186,7 @@ static int nvme_subsystem_unlink(NvmeSubsystem *s) { | ||
444 | if (!enable_fn) | ||
445 | return log_oom(); | ||
446 | |||
447 | - r = write_string_file_at(namespaces_fd, enable_fn, "0", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
448 | + r = write_string_file_at(namespaces_fd, enable_fn, "0", 0); | ||
449 | if (r < 0) | ||
450 | log_warning_errno(r, "Failed to disable namespace '%s' of NVME subsystem '%s', ignoring: %m", e->d_name, s->name); | ||
451 | |||
452 | @@ -254,7 +254,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { | ||
453 | _cleanup_free_ char *truncated = strndup(w, 40); /* kernel refuses more than 40 chars (as per nvme spec) */ | ||
454 | |||
455 | /* The default string stored in 'attr_model' is "Linux" btw. */ | ||
456 | - r = write_string_file_at(subsystem_fd, "attr_model", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
457 | + r = write_string_file_at(subsystem_fd, "attr_model", truncated, 0); | ||
458 | if (r < 0) | ||
459 | log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", w); | ||
460 | } | ||
461 | @@ -268,7 +268,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { | ||
462 | return log_oom(); | ||
463 | |||
464 | /* The default string stored in 'attr_firmware' is `uname -r` btw, but truncated to 8 chars. */ | ||
465 | - r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
466 | + r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, 0); | ||
467 | if (r < 0) | ||
468 | log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", truncated); | ||
469 | } | ||
470 | @@ -295,7 +295,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { | ||
471 | if (!truncated) | ||
472 | return log_oom(); | ||
473 | |||
474 | - r = write_string_file_at(subsystem_fd, "attr_serial", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
475 | + r = write_string_file_at(subsystem_fd, "attr_serial", truncated, 0); | ||
476 | if (r < 0) | ||
477 | log_warning_errno(r, "Failed to set serial of subsystem to '%s', ignoring: %m", truncated); | ||
478 | } | ||
479 | @@ -345,7 +345,7 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co | ||
480 | id = id128_digest(j, l); | ||
481 | } | ||
482 | |||
483 | - r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
484 | + r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), 0); | ||
485 | if (r < 0) | ||
486 | log_warning_errno(r, "Failed to set uuid of namespace to '%s', ignoring: %m", SD_ID128_TO_UUID_STRING(id)); | ||
487 | |||
488 | @@ -408,7 +408,7 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi | ||
489 | if (subsystem_fd < 0) | ||
490 | return log_error_errno(subsystem_fd, "Failed to create NVME subsystem '%s': %m", j); | ||
491 | |||
492 | - r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
493 | + r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", 0); | ||
494 | if (r < 0) | ||
495 | return log_error_errno(r, "Failed to set 'attr_allow_any_host' flag: %m"); | ||
496 | |||
497 | @@ -423,11 +423,11 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi | ||
498 | |||
499 | /* We use /proc/$PID/fd/$FD rather than /proc/self/fd/$FD, because this string is visible to others | ||
500 | * via configfs, and by including the PID it's clear to who the stuff belongs. */ | ||
501 | - r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
502 | + r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), 0); | ||
503 | if (r < 0) | ||
504 | return log_error_errno(r, "Failed to write 'device_path' attribute: %m"); | ||
505 | |||
506 | - r = write_string_file_at(namespace_fd, "enable", "1", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
507 | + r = write_string_file_at(namespace_fd, "enable", "1", 0); | ||
508 | if (r < 0) | ||
509 | return log_error_errno(r, "Failed to write 'enable' attribute: %m"); | ||
510 | |||
511 | @@ -557,19 +557,19 @@ static int nvme_port_add_portnr( | ||
512 | return 0; | ||
513 | } | ||
514 | |||
515 | - r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
516 | + r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), 0); | ||
517 | if (r < 0) | ||
518 | return log_error_errno(r, "Failed to set address family on NVME port %" PRIu16 ": %m", portnr); | ||
519 | |||
520 | - r = write_string_file_at(port_fd, "addr_trtype", "tcp", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
521 | + r = write_string_file_at(port_fd, "addr_trtype", "tcp", 0); | ||
522 | if (r < 0) | ||
523 | return log_error_errno(r, "Failed to set transport type on NVME port %" PRIu16 ": %m", portnr); | ||
524 | |||
525 | - r = write_string_file_at(port_fd, "addr_trsvcid", fname, WRITE_STRING_FILE_DISABLE_BUFFER); | ||
526 | + r = write_string_file_at(port_fd, "addr_trsvcid", fname, 0); | ||
527 | if (r < 0) | ||
528 | return log_error_errno(r, "Failed to set IP port on NVME port %" PRIu16 ": %m", portnr); | ||
529 | |||
530 | - r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", WRITE_STRING_FILE_DISABLE_BUFFER); | ||
531 | + r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", 0); | ||
532 | if (r < 0) | ||
533 | return log_error_errno(r, "Failed to set IP address on NVME port %" PRIu16 ": %m", portnr); | ||
534 | |||
535 | diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c | ||
536 | index febe345b4c..a90b610ba1 100644 | ||
537 | --- a/src/udev/udev-rules.c | ||
538 | +++ b/src/udev/udev-rules.c | ||
539 | @@ -2711,7 +2711,6 @@ static int udev_rule_apply_token_to_event( | ||
540 | log_event_debug(dev, token, "ATTR '%s' writing '%s'", buf, value); | ||
541 | r = write_string_file(buf, value, | ||
542 | WRITE_STRING_FILE_VERIFY_ON_FAILURE | | ||
543 | - WRITE_STRING_FILE_DISABLE_BUFFER | | ||
544 | WRITE_STRING_FILE_AVOID_NEWLINE | | ||
545 | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); | ||
546 | if (r < 0) | ||
547 | diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c | ||
548 | index 4d82c65f0a..3a3d861b83 100644 | ||
549 | --- a/src/vconsole/vconsole-setup.c | ||
550 | +++ b/src/vconsole/vconsole-setup.c | ||
551 | @@ -261,7 +261,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { | ||
552 | static int toggle_utf8_sysfs(bool utf8) { | ||
553 | int r; | ||
554 | |||
555 | - r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); | ||
556 | + r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); | ||
557 | if (r < 0) | ||
558 | return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); | ||
559 | |||
560 | -- | ||
561 | 2.34.1 | ||
562 | |||