Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | From 85e3c3046562ec24fc2f09ebfd08bf9f168091d5 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] 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 | --- |
| 18 | src/basic/cgroup-util.c | 14 +++++++------- |
| 19 | src/basic/procfs-util.c | 4 ++-- |
| 20 | src/basic/smack-util.c | 2 +- |
| 21 | src/basic/util.c | 2 +- |
| 22 | src/binfmt/binfmt.c | 6 +++--- |
| 23 | src/core/main.c | 4 ++-- |
| 24 | src/core/smack-setup.c | 8 ++++---- |
| 25 | src/hibernate-resume/hibernate-resume.c | 2 +- |
| 26 | src/libsystemd/sd-device/sd-device.c | 2 +- |
| 27 | src/login/logind-dbus.c | 2 +- |
| 28 | src/network/networkd-ipv6-proxy-ndp.c | 2 +- |
| 29 | src/network/networkd-link.c | 18 +++++++++--------- |
| 30 | src/nspawn/nspawn-cgroup.c | 2 +- |
| 31 | src/nspawn/nspawn.c | 6 +++--- |
| 32 | src/sleep/sleep.c | 12 ++++++------ |
| 33 | src/udev/udevadm-trigger.c | 2 +- |
| 34 | src/udev/udevd.c | 6 +++--- |
| 35 | src/vconsole/vconsole-setup.c | 2 +- |
| 36 | 18 files changed, 48 insertions(+), 48 deletions(-) |
| 37 | |
| 38 | diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c |
| 39 | index 8ce7ccb..b633226 100644 |
| 40 | --- a/src/basic/cgroup-util.c |
| 41 | +++ b/src/basic/cgroup-util.c |
| 42 | @@ -818,7 +818,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { |
| 43 | |
| 44 | xsprintf(c, PID_FMT "\n", pid); |
| 45 | |
| 46 | - r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 47 | + r = write_string_file(fs, c, 0); |
| 48 | if (r < 0) |
| 49 | return r; |
| 50 | |
| 51 | @@ -1100,7 +1100,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { |
| 52 | |
| 53 | sc = strstrip(contents); |
| 54 | if (isempty(sc)) { |
| 55 | - r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 56 | + r = write_string_file(fs, agent, 0); |
| 57 | if (r < 0) |
| 58 | return r; |
| 59 | } else if (!path_equal(sc, agent)) |
| 60 | @@ -1118,7 +1118,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { |
| 61 | |
| 62 | sc = strstrip(contents); |
| 63 | if (streq(sc, "0")) { |
| 64 | - r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 65 | + r = write_string_file(fs, "1", 0); |
| 66 | if (r < 0) |
| 67 | return r; |
| 68 | |
| 69 | @@ -1145,7 +1145,7 @@ int cg_uninstall_release_agent(const char *controller) { |
| 70 | if (r < 0) |
| 71 | return r; |
| 72 | |
| 73 | - r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 74 | + r = write_string_file(fs, "0", 0); |
| 75 | if (r < 0) |
| 76 | return r; |
| 77 | |
| 78 | @@ -1155,7 +1155,7 @@ int cg_uninstall_release_agent(const char *controller) { |
| 79 | if (r < 0) |
| 80 | return r; |
| 81 | |
| 82 | - r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 83 | + r = write_string_file(fs, "", 0); |
| 84 | if (r < 0) |
| 85 | return r; |
| 86 | |
| 87 | @@ -2012,7 +2012,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri |
| 88 | if (r < 0) |
| 89 | return r; |
| 90 | |
| 91 | - return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 92 | + return write_string_file(p, value, 0); |
| 93 | } |
| 94 | |
| 95 | int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { |
| 96 | @@ -2660,7 +2660,7 @@ int cg_enable_everywhere( |
| 97 | return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); |
| 98 | } |
| 99 | |
| 100 | - r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 101 | + r = write_string_stream(f, s, 0); |
| 102 | if (r < 0) { |
| 103 | log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", |
| 104 | FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); |
| 105 | diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c |
| 106 | index 42ce53d..5751253 100644 |
| 107 | --- a/src/basic/procfs-util.c |
| 108 | +++ b/src/basic/procfs-util.c |
| 109 | @@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) { |
| 110 | * decrease it, as threads-max is the much more relevant sysctl. */ |
| 111 | if (limit > pid_max-1) { |
| 112 | sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ |
| 113 | - r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 114 | + r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); |
| 115 | if (r < 0) |
| 116 | return r; |
| 117 | } |
| 118 | |
| 119 | sprintf(buffer, "%" PRIu64, limit); |
| 120 | - r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 121 | + r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); |
| 122 | if (r < 0) { |
| 123 | uint64_t threads_max; |
| 124 | |
| 125 | diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c |
| 126 | index 123d00e..e7ea78f 100644 |
| 127 | --- a/src/basic/smack-util.c |
| 128 | +++ b/src/basic/smack-util.c |
| 129 | @@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { |
| 130 | return 0; |
| 131 | |
| 132 | p = procfs_file_alloca(pid, "attr/current"); |
| 133 | - r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 134 | + r = write_string_file(p, label, 0); |
| 135 | if (r < 0) |
| 136 | return r; |
| 137 | |
| 138 | diff --git a/src/basic/util.c b/src/basic/util.c |
| 139 | index e577c93..3c64f91 100644 |
| 140 | --- a/src/basic/util.c |
| 141 | +++ b/src/basic/util.c |
| 142 | @@ -631,7 +631,7 @@ void disable_coredumps(void) { |
| 143 | if (detect_container() > 0) |
| 144 | return; |
| 145 | |
| 146 | - r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 147 | + r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); |
| 148 | if (r < 0) |
| 149 | log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); |
| 150 | } |
| 151 | diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c |
| 152 | index af31f09..eec5738 100644 |
| 153 | --- a/src/binfmt/binfmt.c |
| 154 | +++ b/src/binfmt/binfmt.c |
| 155 | @@ -47,7 +47,7 @@ static int delete_rule(const char *rule) { |
| 156 | if (!fn) |
| 157 | return log_oom(); |
| 158 | |
| 159 | - return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 160 | + return write_string_file(fn, "-1", 0); |
| 161 | } |
| 162 | |
| 163 | static int apply_rule(const char *rule) { |
| 164 | @@ -55,7 +55,7 @@ static int apply_rule(const char *rule) { |
| 165 | |
| 166 | (void) delete_rule(rule); |
| 167 | |
| 168 | - r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 169 | + r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); |
| 170 | if (r < 0) |
| 171 | return log_error_errno(r, "Failed to add binary format: %m"); |
| 172 | |
| 173 | @@ -212,7 +212,7 @@ static int run(int argc, char *argv[]) { |
| 174 | } |
| 175 | |
| 176 | /* Flush out all rules */ |
| 177 | - write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 178 | + write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); |
| 179 | |
| 180 | STRV_FOREACH(f, files) { |
| 181 | k = apply_file(*f, true); |
| 182 | diff --git a/src/core/main.c b/src/core/main.c |
| 183 | index 561f956..db6f113 100644 |
| 184 | --- a/src/core/main.c |
| 185 | +++ b/src/core/main.c |
| 186 | @@ -1468,7 +1468,7 @@ static int bump_unix_max_dgram_qlen(void) { |
| 187 | if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) |
| 188 | return 0; |
| 189 | |
| 190 | - r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); |
| 191 | + r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); |
| 192 | if (r < 0) |
| 193 | return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, |
| 194 | "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); |
| 195 | @@ -1683,7 +1683,7 @@ static void initialize_core_pattern(bool skip_setup) { |
| 196 | if (getpid_cached() != 1) |
| 197 | return; |
| 198 | |
| 199 | - r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 200 | + r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); |
| 201 | if (r < 0) |
| 202 | log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); |
| 203 | } |
| 204 | diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c |
| 205 | index 49b37ae..c96eedc 100644 |
| 206 | --- a/src/core/smack-setup.c |
| 207 | +++ b/src/core/smack-setup.c |
| 208 | @@ -350,17 +350,17 @@ int mac_smack_setup(bool *loaded_policy) { |
| 209 | } |
| 210 | |
| 211 | #ifdef SMACK_RUN_LABEL |
| 212 | - r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 213 | + r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); |
| 214 | if (r < 0) |
| 215 | log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); |
| 216 | - r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 217 | + r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); |
| 218 | if (r < 0) |
| 219 | log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); |
| 220 | r = write_string_file("/sys/fs/smackfs/netlabel", |
| 221 | - "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 222 | + "0.0.0.0/0 " SMACK_RUN_LABEL, 0); |
| 223 | if (r < 0) |
| 224 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); |
| 225 | - r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 226 | + r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); |
| 227 | if (r < 0) |
| 228 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); |
| 229 | #endif |
| 230 | diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c |
| 231 | index 17e7cd1..87a7667 100644 |
| 232 | --- a/src/hibernate-resume/hibernate-resume.c |
| 233 | +++ b/src/hibernate-resume/hibernate-resume.c |
| 234 | @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { |
| 235 | return EXIT_FAILURE; |
| 236 | } |
| 237 | |
| 238 | - r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 239 | + r = write_string_file("/sys/power/resume", major_minor, 0); |
| 240 | if (r < 0) { |
| 241 | log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); |
| 242 | return EXIT_FAILURE; |
| 243 | diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c |
| 244 | index 2a69f2e..9d55340 100644 |
| 245 | --- a/src/libsystemd/sd-device/sd-device.c |
| 246 | +++ b/src/libsystemd/sd-device/sd-device.c |
| 247 | @@ -1836,7 +1836,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, |
| 248 | if (!value) |
| 249 | return -ENOMEM; |
| 250 | |
| 251 | - r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); |
| 252 | + r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); |
| 253 | if (r < 0) { |
| 254 | if (r == -ELOOP) |
| 255 | return -EINVAL; |
| 256 | diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c |
| 257 | index 8ab498f..d27ef9c 100644 |
| 258 | --- a/src/login/logind-dbus.c |
| 259 | +++ b/src/login/logind-dbus.c |
| 260 | @@ -1231,7 +1231,7 @@ static int trigger_device(Manager *m, sd_device *d) { |
| 261 | if (!t) |
| 262 | return -ENOMEM; |
| 263 | |
| 264 | - (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 265 | + (void) write_string_file(t, "change", 0); |
| 266 | } |
| 267 | |
| 268 | return 0; |
| 269 | diff --git a/src/network/networkd-ipv6-proxy-ndp.c b/src/network/networkd-ipv6-proxy-ndp.c |
| 270 | index f594b27..c283cc3 100644 |
| 271 | --- a/src/network/networkd-ipv6-proxy-ndp.c |
| 272 | +++ b/src/network/networkd-ipv6-proxy-ndp.c |
| 273 | @@ -43,7 +43,7 @@ static int ipv6_proxy_ndp_set(Link *link) { |
| 274 | v = ipv6_proxy_ndp_is_needed(link); |
| 275 | p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/proxy_ndp"); |
| 276 | |
| 277 | - r = write_string_file(p, one_zero(v), WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 278 | + r = write_string_file(p, one_zero(v), WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 279 | if (r < 0) |
| 280 | log_link_warning_errno(link, r, "Cannot configure proxy NDP for interface: %m"); |
| 281 | |
| 282 | diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c |
| 283 | index 22392d7..e0ed551 100644 |
| 284 | --- a/src/network/networkd-link.c |
| 285 | +++ b/src/network/networkd-link.c |
| 286 | @@ -274,7 +274,7 @@ static int link_enable_ipv6(Link *link) { |
| 287 | |
| 288 | p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/disable_ipv6"); |
| 289 | |
| 290 | - r = write_string_file(p, one_zero(disabled), WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 291 | + r = write_string_file(p, one_zero(disabled), WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 292 | if (r < 0) |
| 293 | log_link_warning_errno(link, r, "Cannot %s IPv6 for interface %s: %m", |
| 294 | enable_disable(!disabled), link->ifname); |
| 295 | @@ -1272,7 +1272,7 @@ static int link_set_proxy_arp(Link *link) { |
| 296 | |
| 297 | p = strjoina("/proc/sys/net/ipv4/conf/", link->ifname, "/proxy_arp"); |
| 298 | |
| 299 | - r = write_string_file(p, one_zero(link->network->proxy_arp), WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 300 | + r = write_string_file(p, one_zero(link->network->proxy_arp), WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 301 | if (r < 0) |
| 302 | log_link_warning_errno(link, r, "Cannot configure proxy ARP for interface: %m"); |
| 303 | |
| 304 | @@ -2541,7 +2541,7 @@ static int link_set_ipv4_forward(Link *link) { |
| 305 | * primarily to keep IPv4 and IPv6 packet forwarding behaviour |
| 306 | * somewhat in sync (see below). */ |
| 307 | |
| 308 | - r = write_string_file("/proc/sys/net/ipv4/ip_forward", "1", WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 309 | + r = write_string_file("/proc/sys/net/ipv4/ip_forward", "1", WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 310 | if (r < 0) |
| 311 | log_link_warning_errno(link, r, "Cannot turn on IPv4 packet forwarding, ignoring: %m"); |
| 312 | |
| 313 | @@ -2563,7 +2563,7 @@ static int link_set_ipv6_forward(Link *link) { |
| 314 | * same behaviour there and also propagate the setting from |
| 315 | * one to all, to keep things simple (see above). */ |
| 316 | |
| 317 | - r = write_string_file("/proc/sys/net/ipv6/conf/all/forwarding", "1", WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 318 | + r = write_string_file("/proc/sys/net/ipv6/conf/all/forwarding", "1", WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 319 | if (r < 0) |
| 320 | log_link_warning_errno(link, r, "Cannot configure IPv6 packet forwarding, ignoring: %m"); |
| 321 | |
| 322 | @@ -2583,7 +2583,7 @@ static int link_set_ipv6_privacy_extensions(Link *link) { |
| 323 | p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/use_tempaddr"); |
| 324 | xsprintf(buf, "%u", (unsigned) link->network->ipv6_privacy_extensions); |
| 325 | |
| 326 | - r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 327 | + r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 328 | if (r < 0) |
| 329 | log_link_warning_errno(link, r, "Cannot configure IPv6 privacy extension for interface: %m"); |
| 330 | |
| 331 | @@ -2607,7 +2607,7 @@ static int link_set_ipv6_accept_ra(Link *link) { |
| 332 | p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/accept_ra"); |
| 333 | |
| 334 | /* We handle router advertisements ourselves, tell the kernel to GTFO */ |
| 335 | - r = write_string_file(p, "0", WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 336 | + r = write_string_file(p, "0", WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 337 | if (r < 0) |
| 338 | log_link_warning_errno(link, r, "Cannot disable kernel IPv6 accept_ra for interface: %m"); |
| 339 | |
| 340 | @@ -2635,7 +2635,7 @@ static int link_set_ipv6_dad_transmits(Link *link) { |
| 341 | p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/dad_transmits"); |
| 342 | xsprintf(buf, "%i", link->network->ipv6_dad_transmits); |
| 343 | |
| 344 | - r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 345 | + r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 346 | if (r < 0) |
| 347 | log_link_warning_errno(link, r, "Cannot set IPv6 dad transmits for interface: %m"); |
| 348 | |
| 349 | @@ -2663,7 +2663,7 @@ static int link_set_ipv6_hop_limit(Link *link) { |
| 350 | p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/hop_limit"); |
| 351 | xsprintf(buf, "%i", link->network->ipv6_hop_limit); |
| 352 | |
| 353 | - r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 354 | + r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 355 | if (r < 0) |
| 356 | log_link_warning_errno(link, r, "Cannot set IPv6 hop limit for interface: %m"); |
| 357 | |
| 358 | @@ -2689,7 +2689,7 @@ static int link_set_ipv6_mtu(Link *link) { |
| 359 | |
| 360 | xsprintf(buf, "%" PRIu32, link->network->ipv6_mtu); |
| 361 | |
| 362 | - r = write_string_file(p, buf, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 363 | + r = write_string_file(p, buf, 0); |
| 364 | if (r < 0) |
| 365 | log_link_warning_errno(link, r, "Cannot set IPv6 MTU for interface: %m"); |
| 366 | |
| 367 | diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c |
| 368 | index 97fa092..b841f51 100644 |
| 369 | --- a/src/nspawn/nspawn-cgroup.c |
| 370 | +++ b/src/nspawn/nspawn-cgroup.c |
| 371 | @@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { |
| 372 | (void) mkdir_parents(fn, 0755); |
| 373 | |
| 374 | sprintf(pid_string, PID_FMT, pid); |
| 375 | - r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 376 | + r = write_string_file(fn, pid_string, 0); |
| 377 | if (r < 0) { |
| 378 | log_error_errno(r, "Failed to move process: %m"); |
| 379 | goto finish; |
| 380 | diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c |
| 381 | index e0c2d71..213790c 100644 |
| 382 | --- a/src/nspawn/nspawn.c |
| 383 | +++ b/src/nspawn/nspawn.c |
| 384 | @@ -2117,7 +2117,7 @@ static int reset_audit_loginuid(void) { |
| 385 | if (streq(p, "4294967295")) |
| 386 | return 0; |
| 387 | |
| 388 | - r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 389 | + r = write_string_file("/proc/self/loginuid", "4294967295", 0); |
| 390 | if (r < 0) { |
| 391 | log_error_errno(r, |
| 392 | "Failed to reset audit login UID. This probably means that your kernel is too\n" |
| 393 | @@ -3195,13 +3195,13 @@ static int setup_uid_map(pid_t pid) { |
| 394 | |
| 395 | xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); |
| 396 | xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range); |
| 397 | - r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 398 | + r = write_string_file(uid_map, line, 0); |
| 399 | if (r < 0) |
| 400 | return log_error_errno(r, "Failed to write UID map: %m"); |
| 401 | |
| 402 | /* We always assign the same UID and GID ranges */ |
| 403 | xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); |
| 404 | - r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 405 | + r = write_string_file(uid_map, line, 0); |
| 406 | if (r < 0) |
| 407 | return log_error_errno(r, "Failed to write GID map: %m"); |
| 408 | |
| 409 | diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c |
| 410 | index 5b7984a..bf818aa 100644 |
| 411 | --- a/src/sleep/sleep.c |
| 412 | +++ b/src/sleep/sleep.c |
| 413 | @@ -43,7 +43,7 @@ static int write_hibernate_location_info(void) { |
| 414 | |
| 415 | /* if it's a swap partition, we just write the disk to /sys/power/resume */ |
| 416 | if (streq(type, "partition")) { |
| 417 | - r = write_string_file("/sys/power/resume", device, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 418 | + r = write_string_file("/sys/power/resume", device, 0); |
| 419 | if (r < 0) |
| 420 | return log_debug_errno(r, "Faileed to write partitoin device to /sys/power/resume: %m"); |
| 421 | |
| 422 | @@ -79,12 +79,12 @@ static int write_hibernate_location_info(void) { |
| 423 | |
| 424 | offset = fiemap->fm_extents[0].fe_physical / page_size(); |
| 425 | xsprintf(offset_str, "%" PRIu64, offset); |
| 426 | - r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 427 | + r = write_string_file("/sys/power/resume_offset", offset_str, 0); |
| 428 | if (r < 0) |
| 429 | return log_debug_errno(r, "Failed to write offset '%s': %m", offset_str); |
| 430 | |
| 431 | xsprintf(device_str, "%lx", (unsigned long)stb.st_dev); |
| 432 | - r = write_string_file("/sys/power/resume", device_str, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 433 | + r = write_string_file("/sys/power/resume", device_str, 0); |
| 434 | if (r < 0) |
| 435 | return log_debug_errno(r, "Failed to write device '%s': %m", device_str); |
| 436 | |
| 437 | @@ -98,7 +98,7 @@ static int write_mode(char **modes) { |
| 438 | STRV_FOREACH(mode, modes) { |
| 439 | int k; |
| 440 | |
| 441 | - k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 442 | + k = write_string_file("/sys/power/disk", *mode, 0); |
| 443 | if (k >= 0) |
| 444 | return 0; |
| 445 | |
| 446 | @@ -117,7 +117,7 @@ static int write_state(FILE **f, char **states) { |
| 447 | STRV_FOREACH(state, states) { |
| 448 | int k; |
| 449 | |
| 450 | - k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 451 | + k = write_string_stream(*f, *state, 0); |
| 452 | if (k >= 0) |
| 453 | return 0; |
| 454 | log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); |
| 455 | @@ -212,7 +212,7 @@ static int rtc_write_wake_alarm(uint64_t sec) { |
| 456 | |
| 457 | xsprintf(buf, "%" PRIu64, sec); |
| 458 | |
| 459 | - r = write_string_file("/sys/class/rtc/rtc0/wakealarm", buf, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 460 | + r = write_string_file("/sys/class/rtc/rtc0/wakealarm", buf, 0); |
| 461 | if (r < 0) |
| 462 | return log_error_errno(r, "Failed to write '%s' to /sys/class/rtc/rtc0/wakealarm: %m", buf); |
| 463 | |
| 464 | diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c |
| 465 | index 9532946..2e576bb 100644 |
| 466 | --- a/src/udev/udevadm-trigger.c |
| 467 | +++ b/src/udev/udevadm-trigger.c |
| 468 | @@ -42,7 +42,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set *settle_se |
| 469 | if (!filename) |
| 470 | return log_oom(); |
| 471 | |
| 472 | - r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 473 | + r = write_string_file(filename, action, 0); |
| 474 | if (r < 0) { |
| 475 | log_debug_errno(r, "Failed to write '%s' to '%s', ignoring: %m", action, filename); |
| 476 | continue; |
| 477 | diff --git a/src/udev/udevd.c b/src/udev/udevd.c |
| 478 | index 0303f36..687d009 100644 |
| 479 | --- a/src/udev/udevd.c |
| 480 | +++ b/src/udev/udevd.c |
| 481 | @@ -1218,7 +1218,7 @@ static int synthesize_change(sd_device *dev) { |
| 482 | */ |
| 483 | log_debug("Device '%s' is closed, synthesising 'change'", devname); |
| 484 | strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); |
| 485 | - write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 486 | + write_string_file(filename, "change", 0); |
| 487 | |
| 488 | FOREACH_DEVICE(e, d) { |
| 489 | const char *t, *n, *s; |
| 490 | @@ -1233,7 +1233,7 @@ static int synthesize_change(sd_device *dev) { |
| 491 | |
| 492 | log_debug("Device '%s' is closed, synthesising partition '%s' 'change'", devname, n); |
| 493 | strscpyl(filename, sizeof(filename), s, "/uevent", NULL); |
| 494 | - write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 495 | + write_string_file(filename, "change", 0); |
| 496 | } |
| 497 | |
| 498 | return 0; |
| 499 | @@ -1241,7 +1241,7 @@ static int synthesize_change(sd_device *dev) { |
| 500 | |
| 501 | log_debug("Device %s is closed, synthesising 'change'", devname); |
| 502 | strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); |
| 503 | - write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 504 | + write_string_file(filename, "change", 0); |
| 505 | |
| 506 | return 0; |
| 507 | } |
| 508 | diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c |
| 509 | index ebdeba3..aa879e6 100644 |
| 510 | --- a/src/vconsole/vconsole-setup.c |
| 511 | +++ b/src/vconsole/vconsole-setup.c |
| 512 | @@ -114,7 +114,7 @@ static int toggle_utf8(const char *name, int fd, bool utf8) { |
| 513 | static int toggle_utf8_sysfs(bool utf8) { |
| 514 | int r; |
| 515 | |
| 516 | - r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); |
| 517 | + r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); |
| 518 | if (r < 0) |
| 519 | return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); |
| 520 | |
| 521 | -- |
| 522 | 2.7.4 |
| 523 | |