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