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