Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From f92fd7e77ed5aab2dda01a20e6891c37f09415d3 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 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> |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 17 | [Rebased for v242] |
| 18 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 19 | [rebased for systemd 243] |
| 20 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 21 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 22 | --- |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 23 | src/basic/cgroup-util.c | 10 +++++----- |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 24 | src/basic/procfs-util.c | 4 ++-- |
| 25 | src/basic/smack-util.c | 2 +- |
| 26 | src/basic/util.c | 2 +- |
| 27 | src/binfmt/binfmt.c | 6 +++--- |
| 28 | src/core/main.c | 4 ++-- |
| 29 | src/core/smack-setup.c | 8 ++++---- |
| 30 | src/hibernate-resume/hibernate-resume.c | 2 +- |
| 31 | src/libsystemd/sd-device/sd-device.c | 2 +- |
| 32 | src/login/logind-dbus.c | 2 +- |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 33 | src/nspawn/nspawn-cgroup.c | 2 +- |
| 34 | src/nspawn/nspawn.c | 6 +++--- |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 35 | src/shared/cgroup-setup.c | 4 ++-- |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 36 | src/shared/sysctl-util.c | 2 +- |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 37 | src/sleep/sleep.c | 8 ++++---- |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 38 | src/udev/udevadm-trigger.c | 2 +- |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 39 | src/udev/udevd.c | 2 +- |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 40 | src/vconsole/vconsole-setup.c | 2 +- |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 41 | 18 files changed, 35 insertions(+), 35 deletions(-) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 42 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 43 | Index: systemd-stable/src/basic/cgroup-util.c |
| 44 | =================================================================== |
| 45 | --- systemd-stable.orig/src/basic/cgroup-util.c |
| 46 | +++ systemd-stable/src/basic/cgroup-util.c |
| 47 | @@ -769,7 +769,7 @@ int cg_install_release_agent(const char |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 48 | |
| 49 | sc = strstrip(contents); |
| 50 | if (isempty(sc)) { |
| 51 | - r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 52 | + r = write_string_file(fs, agent, 0); |
| 53 | if (r < 0) |
| 54 | return r; |
| 55 | } else if (!path_equal(sc, agent)) |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 56 | @@ -787,7 +787,7 @@ int cg_install_release_agent(const char |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 57 | |
| 58 | sc = strstrip(contents); |
| 59 | if (streq(sc, "0")) { |
| 60 | - r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 61 | + r = write_string_file(fs, "1", 0); |
| 62 | if (r < 0) |
| 63 | return r; |
| 64 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 65 | @@ -814,7 +814,7 @@ int cg_uninstall_release_agent(const cha |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 66 | if (r < 0) |
| 67 | return r; |
| 68 | |
| 69 | - r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 70 | + r = write_string_file(fs, "0", 0); |
| 71 | if (r < 0) |
| 72 | return r; |
| 73 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 74 | @@ -824,7 +824,7 @@ int cg_uninstall_release_agent(const cha |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 75 | if (r < 0) |
| 76 | return r; |
| 77 | |
| 78 | - r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 79 | + r = write_string_file(fs, "", 0); |
| 80 | if (r < 0) |
| 81 | return r; |
| 82 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 83 | @@ -1656,7 +1656,7 @@ int cg_set_attribute(const char *control |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 84 | if (r < 0) |
| 85 | return r; |
| 86 | |
| 87 | - return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 88 | + return write_string_file(p, value, 0); |
| 89 | } |
| 90 | |
| 91 | int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 92 | Index: systemd-stable/src/basic/procfs-util.c |
| 93 | =================================================================== |
| 94 | --- systemd-stable.orig/src/basic/procfs-util.c |
| 95 | +++ systemd-stable/src/basic/procfs-util.c |
| 96 | @@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 97 | * decrease it, as threads-max is the much more relevant sysctl. */ |
| 98 | if (limit > pid_max-1) { |
| 99 | sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ |
| 100 | - r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 101 | + r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); |
| 102 | if (r < 0) |
| 103 | return r; |
| 104 | } |
| 105 | |
| 106 | sprintf(buffer, "%" PRIu64, limit); |
| 107 | - r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 108 | + r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); |
| 109 | if (r < 0) { |
| 110 | uint64_t threads_max; |
| 111 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 112 | Index: systemd-stable/src/basic/smack-util.c |
| 113 | =================================================================== |
| 114 | --- systemd-stable.orig/src/basic/smack-util.c |
| 115 | +++ systemd-stable/src/basic/smack-util.c |
| 116 | @@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 117 | return 0; |
| 118 | |
| 119 | p = procfs_file_alloca(pid, "attr/current"); |
| 120 | - r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 121 | + r = write_string_file(p, label, 0); |
| 122 | if (r < 0) |
| 123 | return r; |
| 124 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 125 | Index: systemd-stable/src/basic/util.c |
| 126 | =================================================================== |
| 127 | --- systemd-stable.orig/src/basic/util.c |
| 128 | +++ systemd-stable/src/basic/util.c |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 129 | @@ -267,7 +267,7 @@ void disable_coredumps(void) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 130 | if (detect_container() > 0) |
| 131 | return; |
| 132 | |
| 133 | - r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 134 | + r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); |
| 135 | if (r < 0) |
| 136 | log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); |
| 137 | } |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 138 | Index: systemd-stable/src/binfmt/binfmt.c |
| 139 | =================================================================== |
| 140 | --- systemd-stable.orig/src/binfmt/binfmt.c |
| 141 | +++ systemd-stable/src/binfmt/binfmt.c |
| 142 | @@ -48,7 +48,7 @@ static int delete_rule(const char *rule) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 143 | if (!fn) |
| 144 | return log_oom(); |
| 145 | |
| 146 | - return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 147 | + return write_string_file(fn, "-1", 0); |
| 148 | } |
| 149 | |
| 150 | static int apply_rule(const char *rule) { |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 151 | @@ -56,7 +56,7 @@ static int apply_rule(const char *rule) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 152 | |
| 153 | (void) delete_rule(rule); |
| 154 | |
| 155 | - r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 156 | + r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); |
| 157 | if (r < 0) |
| 158 | return log_error_errno(r, "Failed to add binary format: %m"); |
| 159 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 160 | @@ -223,7 +223,7 @@ static int run(int argc, char *argv[]) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | /* Flush out all rules */ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 164 | - (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 165 | + (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 166 | |
| 167 | STRV_FOREACH(f, files) { |
| 168 | k = apply_file(*f, true); |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 169 | Index: systemd-stable/src/core/main.c |
| 170 | =================================================================== |
| 171 | --- systemd-stable.orig/src/core/main.c |
| 172 | +++ systemd-stable/src/core/main.c |
| 173 | @@ -1382,7 +1382,7 @@ static int bump_unix_max_dgram_qlen(void |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 174 | if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) |
| 175 | return 0; |
| 176 | |
| 177 | - r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); |
| 178 | + r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); |
| 179 | if (r < 0) |
| 180 | return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, |
| 181 | "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 182 | @@ -1668,7 +1668,7 @@ static void initialize_core_pattern(bool |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 183 | if (getpid_cached() != 1) |
| 184 | return; |
| 185 | |
| 186 | - r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 187 | + r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); |
| 188 | if (r < 0) |
| 189 | log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); |
| 190 | } |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 191 | Index: systemd-stable/src/core/smack-setup.c |
| 192 | =================================================================== |
| 193 | --- systemd-stable.orig/src/core/smack-setup.c |
| 194 | +++ systemd-stable/src/core/smack-setup.c |
| 195 | @@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | #ifdef SMACK_RUN_LABEL |
| 199 | - r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 200 | + r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); |
| 201 | if (r < 0) |
| 202 | log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); |
| 203 | - r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 204 | + r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); |
| 205 | if (r < 0) |
| 206 | log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); |
| 207 | r = write_string_file("/sys/fs/smackfs/netlabel", |
| 208 | - "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 209 | + "0.0.0.0/0 " SMACK_RUN_LABEL, 0); |
| 210 | if (r < 0) |
| 211 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); |
| 212 | - r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 213 | + r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); |
| 214 | if (r < 0) |
| 215 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); |
| 216 | #endif |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 217 | Index: systemd-stable/src/hibernate-resume/hibernate-resume.c |
| 218 | =================================================================== |
| 219 | --- systemd-stable.orig/src/hibernate-resume/hibernate-resume.c |
| 220 | +++ systemd-stable/src/hibernate-resume/hibernate-resume.c |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 221 | @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { |
| 222 | return EXIT_FAILURE; |
| 223 | } |
| 224 | |
| 225 | - r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 226 | + r = write_string_file("/sys/power/resume", major_minor, 0); |
| 227 | if (r < 0) { |
| 228 | log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); |
| 229 | return EXIT_FAILURE; |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 230 | Index: systemd-stable/src/libsystemd/sd-device/sd-device.c |
| 231 | =================================================================== |
| 232 | --- systemd-stable.orig/src/libsystemd/sd-device/sd-device.c |
| 233 | +++ systemd-stable/src/libsystemd/sd-device/sd-device.c |
| 234 | @@ -1877,7 +1877,7 @@ _public_ int sd_device_set_sysattr_value |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 235 | if (!value) |
| 236 | return -ENOMEM; |
| 237 | |
| 238 | - r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); |
| 239 | + r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); |
| 240 | if (r < 0) { |
| 241 | if (r == -ELOOP) |
| 242 | return -EINVAL; |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 243 | Index: systemd-stable/src/login/logind-dbus.c |
| 244 | =================================================================== |
| 245 | --- systemd-stable.orig/src/login/logind-dbus.c |
| 246 | +++ systemd-stable/src/login/logind-dbus.c |
| 247 | @@ -1341,7 +1341,7 @@ static int trigger_device(Manager *m, sd |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 248 | if (!t) |
| 249 | return -ENOMEM; |
| 250 | |
| 251 | - (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 252 | + (void) write_string_file(t, "change", 0); |
| 253 | } |
| 254 | |
| 255 | return 0; |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 256 | Index: systemd-stable/src/nspawn/nspawn-cgroup.c |
| 257 | =================================================================== |
| 258 | --- systemd-stable.orig/src/nspawn/nspawn-cgroup.c |
| 259 | +++ systemd-stable/src/nspawn/nspawn-cgroup.c |
| 260 | @@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 261 | fn = strjoina(tree, cgroup, "/cgroup.procs"); |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 262 | |
| 263 | sprintf(pid_string, PID_FMT, pid); |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 264 | - r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); |
| 265 | + r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 266 | if (r < 0) { |
| 267 | log_error_errno(r, "Failed to move process: %m"); |
| 268 | goto finish; |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 269 | Index: systemd-stable/src/nspawn/nspawn.c |
| 270 | =================================================================== |
| 271 | --- systemd-stable.orig/src/nspawn/nspawn.c |
| 272 | +++ systemd-stable/src/nspawn/nspawn.c |
| 273 | @@ -2493,7 +2493,7 @@ static int reset_audit_loginuid(void) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 274 | if (streq(p, "4294967295")) |
| 275 | return 0; |
| 276 | |
| 277 | - r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 278 | + r = write_string_file("/proc/self/loginuid", "4294967295", 0); |
| 279 | if (r < 0) { |
| 280 | log_error_errno(r, |
| 281 | "Failed to reset audit login UID. This probably means that your kernel is too\n" |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 282 | @@ -3726,13 +3726,13 @@ static int setup_uid_map(pid_t pid) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 283 | |
| 284 | xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); |
| 285 | xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range); |
| 286 | - r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 287 | + r = write_string_file(uid_map, line, 0); |
| 288 | if (r < 0) |
| 289 | return log_error_errno(r, "Failed to write UID map: %m"); |
| 290 | |
| 291 | /* We always assign the same UID and GID ranges */ |
| 292 | xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); |
| 293 | - r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 294 | + r = write_string_file(uid_map, line, 0); |
| 295 | if (r < 0) |
| 296 | return log_error_errno(r, "Failed to write GID map: %m"); |
| 297 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 298 | Index: systemd-stable/src/shared/cgroup-setup.c |
| 299 | =================================================================== |
| 300 | --- systemd-stable.orig/src/shared/cgroup-setup.c |
| 301 | +++ systemd-stable/src/shared/cgroup-setup.c |
| 302 | @@ -267,7 +267,7 @@ int cg_attach(const char *controller, co |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 303 | |
| 304 | xsprintf(c, PID_FMT "\n", pid); |
| 305 | |
| 306 | - r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 307 | + r = write_string_file(fs, c, 0); |
| 308 | if (r < 0) |
| 309 | return r; |
| 310 | |
| 311 | @@ -817,7 +817,7 @@ int cg_enable_everywhere( |
| 312 | return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); |
| 313 | } |
| 314 | |
| 315 | - r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 316 | + r = write_string_stream(f, s, 0); |
| 317 | if (r < 0) { |
| 318 | log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", |
| 319 | FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 320 | Index: systemd-stable/src/shared/sysctl-util.c |
| 321 | =================================================================== |
| 322 | --- systemd-stable.orig/src/shared/sysctl-util.c |
| 323 | +++ systemd-stable/src/shared/sysctl-util.c |
| 324 | @@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, con |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 325 | |
| 326 | log_debug("Setting '%s' to '%s'", p, value); |
| 327 | |
| 328 | - return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 329 | + return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 330 | } |
| 331 | |
| 332 | int sysctl_read(const char *property, char **content) { |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 333 | Index: systemd-stable/src/sleep/sleep.c |
| 334 | =================================================================== |
| 335 | --- systemd-stable.orig/src/sleep/sleep.c |
| 336 | +++ systemd-stable/src/sleep/sleep.c |
| 337 | @@ -48,7 +48,7 @@ static int write_hibernate_location_info |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 338 | assert(hibernate_location->swap); |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 339 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 340 | xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno)); |
| 341 | - r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 342 | + r = write_string_file("/sys/power/resume", resume_str, 0); |
| 343 | if (r < 0) |
| 344 | return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m", |
| 345 | hibernate_location->swap->device, resume_str); |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 346 | @@ -75,7 +75,7 @@ static int write_hibernate_location_info |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 347 | } |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 348 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 349 | xsprintf(offset_str, "%" PRIu64, hibernate_location->offset); |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 350 | - r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 351 | + r = write_string_file("/sys/power/resume_offset", offset_str, 0); |
| 352 | if (r < 0) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 353 | return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m", |
| 354 | hibernate_location->swap->device, offset_str); |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 355 | @@ -92,7 +92,7 @@ static int write_mode(char **modes) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 356 | STRV_FOREACH(mode, modes) { |
| 357 | int k; |
| 358 | |
| 359 | - k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 360 | + k = write_string_file("/sys/power/disk", *mode, 0); |
| 361 | if (k >= 0) |
| 362 | return 0; |
| 363 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 364 | @@ -114,7 +114,7 @@ static int write_state(FILE **f, char ** |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 365 | STRV_FOREACH(state, states) { |
| 366 | int k; |
| 367 | |
| 368 | - k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 369 | + k = write_string_stream(*f, *state, 0); |
| 370 | if (k >= 0) |
| 371 | return 0; |
| 372 | log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 373 | Index: systemd-stable/src/udev/udevadm-trigger.c |
| 374 | =================================================================== |
| 375 | --- systemd-stable.orig/src/udev/udevadm-trigger.c |
| 376 | +++ systemd-stable/src/udev/udevadm-trigger.c |
| 377 | @@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerato |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 378 | if (!filename) |
| 379 | return log_oom(); |
| 380 | |
| 381 | - r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 382 | + r = write_string_file(filename, action, 0); |
| 383 | if (r < 0) { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 384 | bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV, -EROFS); |
| 385 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 386 | Index: systemd-stable/src/udev/udevd.c |
| 387 | =================================================================== |
| 388 | --- systemd-stable.orig/src/udev/udevd.c |
| 389 | +++ systemd-stable/src/udev/udevd.c |
| 390 | @@ -1153,7 +1153,7 @@ static int synthesize_change_one(sd_devi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 391 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 392 | filename = strjoina(syspath, "/uevent"); |
| 393 | log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath); |
| 394 | - r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 395 | + r = write_string_file(filename, "change", 0); |
| 396 | if (r < 0) |
| 397 | return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename); |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 398 | return 0; |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 399 | Index: systemd-stable/src/vconsole/vconsole-setup.c |
| 400 | =================================================================== |
| 401 | --- systemd-stable.orig/src/vconsole/vconsole-setup.c |
| 402 | +++ systemd-stable/src/vconsole/vconsole-setup.c |
| 403 | @@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *na |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 404 | static int toggle_utf8_sysfs(bool utf8) { |
| 405 | int r; |
| 406 | |
| 407 | - r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); |
| 408 | + r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); |
| 409 | if (r < 0) |
| 410 | return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); |
| 411 | |