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 | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 19 | --- |
| 20 | src/basic/cgroup-util.c | 14 +++++++------- |
| 21 | src/basic/procfs-util.c | 4 ++-- |
| 22 | src/basic/smack-util.c | 2 +- |
| 23 | src/basic/util.c | 2 +- |
| 24 | src/binfmt/binfmt.c | 6 +++--- |
| 25 | src/core/main.c | 4 ++-- |
| 26 | src/core/smack-setup.c | 8 ++++---- |
| 27 | src/hibernate-resume/hibernate-resume.c | 2 +- |
| 28 | src/libsystemd/sd-device/sd-device.c | 2 +- |
| 29 | src/login/logind-dbus.c | 2 +- |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 30 | src/nspawn/nspawn-cgroup.c | 2 +- |
| 31 | src/nspawn/nspawn.c | 6 +++--- |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 32 | src/shared/sysctl-util.c | 2 +- |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 33 | src/sleep/sleep.c | 12 ++++++------ |
| 34 | src/udev/udevadm-trigger.c | 2 +- |
| 35 | src/udev/udevd.c | 6 +++--- |
| 36 | src/vconsole/vconsole-setup.c | 2 +- |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 37 | 17 files changed, 39 insertions(+), 39 deletions(-) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 38 | |
| 39 | diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 40 | index fc28109..44fe985 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 41 | --- a/src/basic/cgroup-util.c |
| 42 | +++ b/src/basic/cgroup-util.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 43 | @@ -822,7 +822,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] | 44 | |
| 45 | xsprintf(c, PID_FMT "\n", pid); |
| 46 | |
| 47 | - r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 48 | + r = write_string_file(fs, c, 0); |
| 49 | if (r < 0) |
| 50 | return r; |
| 51 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 52 | @@ -1104,7 +1104,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 53 | |
| 54 | sc = strstrip(contents); |
| 55 | if (isempty(sc)) { |
| 56 | - r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 57 | + r = write_string_file(fs, agent, 0); |
| 58 | if (r < 0) |
| 59 | return r; |
| 60 | } else if (!path_equal(sc, agent)) |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 61 | @@ -1122,7 +1122,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 62 | |
| 63 | sc = strstrip(contents); |
| 64 | if (streq(sc, "0")) { |
| 65 | - r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 66 | + r = write_string_file(fs, "1", 0); |
| 67 | if (r < 0) |
| 68 | return r; |
| 69 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 70 | @@ -1149,7 +1149,7 @@ int cg_uninstall_release_agent(const char *controller) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 71 | if (r < 0) |
| 72 | return r; |
| 73 | |
| 74 | - r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 75 | + r = write_string_file(fs, "0", 0); |
| 76 | if (r < 0) |
| 77 | return r; |
| 78 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 79 | @@ -1159,7 +1159,7 @@ int cg_uninstall_release_agent(const char *controller) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 80 | if (r < 0) |
| 81 | return r; |
| 82 | |
| 83 | - r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 84 | + r = write_string_file(fs, "", 0); |
| 85 | if (r < 0) |
| 86 | return r; |
| 87 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 88 | @@ -2016,7 +2016,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] | 89 | if (r < 0) |
| 90 | return r; |
| 91 | |
| 92 | - return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 93 | + return write_string_file(p, value, 0); |
| 94 | } |
| 95 | |
| 96 | int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 97 | @@ -2664,7 +2664,7 @@ int cg_enable_everywhere( |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 98 | return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); |
| 99 | } |
| 100 | |
| 101 | - r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 102 | + r = write_string_stream(f, s, 0); |
| 103 | if (r < 0) { |
| 104 | log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", |
| 105 | FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); |
| 106 | diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 107 | index 7aaf95b..25fc3de 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 108 | --- a/src/basic/procfs-util.c |
| 109 | +++ b/src/basic/procfs-util.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 110 | @@ -85,13 +85,13 @@ int procfs_tasks_set_limit(uint64_t limit) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 111 | * decrease it, as threads-max is the much more relevant sysctl. */ |
| 112 | if (limit > pid_max-1) { |
| 113 | sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ |
| 114 | - r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 115 | + r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); |
| 116 | if (r < 0) |
| 117 | return r; |
| 118 | } |
| 119 | |
| 120 | sprintf(buffer, "%" PRIu64, limit); |
| 121 | - r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 122 | + r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); |
| 123 | if (r < 0) { |
| 124 | uint64_t threads_max; |
| 125 | |
| 126 | diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c |
| 127 | index 123d00e..e7ea78f 100644 |
| 128 | --- a/src/basic/smack-util.c |
| 129 | +++ b/src/basic/smack-util.c |
| 130 | @@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { |
| 131 | return 0; |
| 132 | |
| 133 | p = procfs_file_alloca(pid, "attr/current"); |
| 134 | - r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 135 | + r = write_string_file(p, label, 0); |
| 136 | if (r < 0) |
| 137 | return r; |
| 138 | |
| 139 | diff --git a/src/basic/util.c b/src/basic/util.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 140 | index 93d610b..97dca64 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 141 | --- a/src/basic/util.c |
| 142 | +++ b/src/basic/util.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 143 | @@ -294,7 +294,7 @@ void disable_coredumps(void) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 144 | if (detect_container() > 0) |
| 145 | return; |
| 146 | |
| 147 | - r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 148 | + r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); |
| 149 | if (r < 0) |
| 150 | log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); |
| 151 | } |
| 152 | diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 153 | index 66e2f01..5daa43b 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 154 | --- a/src/binfmt/binfmt.c |
| 155 | +++ b/src/binfmt/binfmt.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 156 | @@ -48,7 +48,7 @@ static int delete_rule(const char *rule) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 157 | if (!fn) |
| 158 | return log_oom(); |
| 159 | |
| 160 | - return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 161 | + return write_string_file(fn, "-1", 0); |
| 162 | } |
| 163 | |
| 164 | static int apply_rule(const char *rule) { |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 165 | @@ -56,7 +56,7 @@ static int apply_rule(const char *rule) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 166 | |
| 167 | (void) delete_rule(rule); |
| 168 | |
| 169 | - r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 170 | + r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); |
| 171 | if (r < 0) |
| 172 | return log_error_errno(r, "Failed to add binary format: %m"); |
| 173 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 174 | @@ -213,7 +213,7 @@ static int run(int argc, char *argv[]) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | /* Flush out all rules */ |
| 178 | - write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 179 | + write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); |
| 180 | |
| 181 | STRV_FOREACH(f, files) { |
| 182 | k = apply_file(*f, true); |
| 183 | diff --git a/src/core/main.c b/src/core/main.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 184 | index 46db471..726ccaf 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 185 | --- a/src/core/main.c |
| 186 | +++ b/src/core/main.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 187 | @@ -1469,7 +1469,7 @@ static int bump_unix_max_dgram_qlen(void) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 188 | if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) |
| 189 | return 0; |
| 190 | |
| 191 | - r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); |
| 192 | + r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); |
| 193 | if (r < 0) |
| 194 | return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, |
| 195 | "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 196 | @@ -1684,7 +1684,7 @@ static void initialize_core_pattern(bool skip_setup) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 197 | if (getpid_cached() != 1) |
| 198 | return; |
| 199 | |
| 200 | - r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 201 | + r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); |
| 202 | if (r < 0) |
| 203 | log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); |
| 204 | } |
| 205 | diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 206 | index cd7fb01..077e861 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 207 | --- a/src/core/smack-setup.c |
| 208 | +++ b/src/core/smack-setup.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 209 | @@ -351,17 +351,17 @@ int mac_smack_setup(bool *loaded_policy) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | #ifdef SMACK_RUN_LABEL |
| 213 | - r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 214 | + r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); |
| 215 | if (r < 0) |
| 216 | log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); |
| 217 | - r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 218 | + r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); |
| 219 | if (r < 0) |
| 220 | log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); |
| 221 | r = write_string_file("/sys/fs/smackfs/netlabel", |
| 222 | - "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 223 | + "0.0.0.0/0 " SMACK_RUN_LABEL, 0); |
| 224 | if (r < 0) |
| 225 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); |
| 226 | - r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 227 | + r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); |
| 228 | if (r < 0) |
| 229 | log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); |
| 230 | #endif |
| 231 | diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c |
| 232 | index 17e7cd1..87a7667 100644 |
| 233 | --- a/src/hibernate-resume/hibernate-resume.c |
| 234 | +++ b/src/hibernate-resume/hibernate-resume.c |
| 235 | @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { |
| 236 | return EXIT_FAILURE; |
| 237 | } |
| 238 | |
| 239 | - r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 240 | + r = write_string_file("/sys/power/resume", major_minor, 0); |
| 241 | if (r < 0) { |
| 242 | log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); |
| 243 | return EXIT_FAILURE; |
| 244 | diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 245 | index c2315c0..00f81b4 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 246 | --- a/src/libsystemd/sd-device/sd-device.c |
| 247 | +++ b/src/libsystemd/sd-device/sd-device.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 248 | @@ -1852,7 +1852,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] | 249 | if (!value) |
| 250 | return -ENOMEM; |
| 251 | |
| 252 | - r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); |
| 253 | + r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); |
| 254 | if (r < 0) { |
| 255 | if (r == -ELOOP) |
| 256 | return -EINVAL; |
| 257 | diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 258 | index 2cebcce..7111fc1 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 259 | --- a/src/login/logind-dbus.c |
| 260 | +++ b/src/login/logind-dbus.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 261 | @@ -1285,7 +1285,7 @@ static int trigger_device(Manager *m, sd_device *d) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 262 | if (!t) |
| 263 | return -ENOMEM; |
| 264 | |
| 265 | - (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 266 | + (void) write_string_file(t, "change", 0); |
| 267 | } |
| 268 | |
| 269 | return 0; |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 270 | diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 271 | index 168125d..dd0ab79 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 272 | --- a/src/nspawn/nspawn-cgroup.c |
| 273 | +++ b/src/nspawn/nspawn-cgroup.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 274 | @@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 275 | (void) mkdir_parents(fn, 0755); |
| 276 | |
| 277 | sprintf(pid_string, PID_FMT, pid); |
| 278 | - r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 279 | + r = write_string_file(fn, pid_string, 0); |
| 280 | if (r < 0) { |
| 281 | log_error_errno(r, "Failed to move process: %m"); |
| 282 | goto finish; |
| 283 | diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 284 | index 3b0ecb1..a1b5240 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 285 | --- a/src/nspawn/nspawn.c |
| 286 | +++ b/src/nspawn/nspawn.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 287 | @@ -2341,7 +2341,7 @@ static int reset_audit_loginuid(void) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 288 | if (streq(p, "4294967295")) |
| 289 | return 0; |
| 290 | |
| 291 | - r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 292 | + r = write_string_file("/proc/self/loginuid", "4294967295", 0); |
| 293 | if (r < 0) { |
| 294 | log_error_errno(r, |
| 295 | "Failed to reset audit login UID. This probably means that your kernel is too\n" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 296 | @@ -3531,13 +3531,13 @@ static int setup_uid_map(pid_t pid) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 297 | |
| 298 | xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); |
| 299 | xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range); |
| 300 | - r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 301 | + r = write_string_file(uid_map, line, 0); |
| 302 | if (r < 0) |
| 303 | return log_error_errno(r, "Failed to write UID map: %m"); |
| 304 | |
| 305 | /* We always assign the same UID and GID ranges */ |
| 306 | xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); |
| 307 | - r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 308 | + r = write_string_file(uid_map, line, 0); |
| 309 | if (r < 0) |
| 310 | return log_error_errno(r, "Failed to write GID map: %m"); |
| 311 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 312 | diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c |
| 313 | index 9be4055..f935cde 100644 |
| 314 | --- a/src/shared/sysctl-util.c |
| 315 | +++ b/src/shared/sysctl-util.c |
| 316 | @@ -73,7 +73,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c |
| 317 | |
| 318 | log_debug("Setting '%s' to '%s'", p, value); |
| 319 | |
| 320 | - return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); |
| 321 | + return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); |
| 322 | } |
| 323 | |
| 324 | int sysctl_read(const char *property, char **content) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 325 | diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 326 | index 11aabaf..6aa5d37 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 327 | --- a/src/sleep/sleep.c |
| 328 | +++ b/src/sleep/sleep.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 329 | @@ -48,7 +48,7 @@ static int write_hibernate_location_info(void) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 330 | |
| 331 | /* if it's a swap partition, we just write the disk to /sys/power/resume */ |
| 332 | if (streq(type, "partition")) { |
| 333 | - r = write_string_file("/sys/power/resume", device, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 334 | + r = write_string_file("/sys/power/resume", device, 0); |
| 335 | if (r < 0) |
| 336 | return log_debug_errno(r, "Faileed to write partitoin device to /sys/power/resume: %m"); |
| 337 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 338 | @@ -84,12 +84,12 @@ static int write_hibernate_location_info(void) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 339 | |
| 340 | offset = fiemap->fm_extents[0].fe_physical / page_size(); |
| 341 | xsprintf(offset_str, "%" PRIu64, offset); |
| 342 | - r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 343 | + r = write_string_file("/sys/power/resume_offset", offset_str, 0); |
| 344 | if (r < 0) |
| 345 | return log_debug_errno(r, "Failed to write offset '%s': %m", offset_str); |
| 346 | |
| 347 | xsprintf(device_str, "%lx", (unsigned long)stb.st_dev); |
| 348 | - r = write_string_file("/sys/power/resume", device_str, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 349 | + r = write_string_file("/sys/power/resume", device_str, 0); |
| 350 | if (r < 0) |
| 351 | return log_debug_errno(r, "Failed to write device '%s': %m", device_str); |
| 352 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 353 | @@ -103,7 +103,7 @@ static int write_mode(char **modes) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 354 | STRV_FOREACH(mode, modes) { |
| 355 | int k; |
| 356 | |
| 357 | - k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 358 | + k = write_string_file("/sys/power/disk", *mode, 0); |
| 359 | if (k >= 0) |
| 360 | return 0; |
| 361 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 362 | @@ -122,7 +122,7 @@ static int write_state(FILE **f, char **states) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 363 | STRV_FOREACH(state, states) { |
| 364 | int k; |
| 365 | |
| 366 | - k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 367 | + k = write_string_stream(*f, *state, 0); |
| 368 | if (k >= 0) |
| 369 | return 0; |
| 370 | log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 371 | @@ -217,7 +217,7 @@ static int rtc_write_wake_alarm(uint64_t sec) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 372 | |
| 373 | xsprintf(buf, "%" PRIu64, sec); |
| 374 | |
| 375 | - r = write_string_file("/sys/class/rtc/rtc0/wakealarm", buf, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 376 | + r = write_string_file("/sys/class/rtc/rtc0/wakealarm", buf, 0); |
| 377 | if (r < 0) |
| 378 | return log_error_errno(r, "Failed to write '%s' to /sys/class/rtc/rtc0/wakealarm: %m", buf); |
| 379 | |
| 380 | diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 381 | index b7dafb7..bab4907 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 382 | --- a/src/udev/udevadm-trigger.c |
| 383 | +++ b/src/udev/udevadm-trigger.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 384 | @@ -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] | 385 | if (!filename) |
| 386 | return log_oom(); |
| 387 | |
| 388 | - r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); |
| 389 | + r = write_string_file(filename, action, 0); |
| 390 | if (r < 0) { |
| 391 | log_debug_errno(r, "Failed to write '%s' to '%s', ignoring: %m", action, filename); |
| 392 | continue; |
| 393 | diff --git a/src/udev/udevd.c b/src/udev/udevd.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 394 | index 140ec35..33063a9 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 395 | --- a/src/udev/udevd.c |
| 396 | +++ b/src/udev/udevd.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 397 | @@ -1185,7 +1185,7 @@ static int synthesize_change(sd_device *dev) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 398 | */ |
| 399 | log_debug("Device '%s' is closed, synthesising 'change'", devname); |
| 400 | strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); |
| 401 | - write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 402 | + write_string_file(filename, "change", 0); |
| 403 | |
| 404 | FOREACH_DEVICE(e, d) { |
| 405 | const char *t, *n, *s; |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 406 | @@ -1200,7 +1200,7 @@ static int synthesize_change(sd_device *dev) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 407 | |
| 408 | log_debug("Device '%s' is closed, synthesising partition '%s' 'change'", devname, n); |
| 409 | strscpyl(filename, sizeof(filename), s, "/uevent", NULL); |
| 410 | - write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 411 | + write_string_file(filename, "change", 0); |
| 412 | } |
| 413 | |
| 414 | return 0; |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 415 | @@ -1208,7 +1208,7 @@ static int synthesize_change(sd_device *dev) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 416 | |
| 417 | log_debug("Device %s is closed, synthesising 'change'", devname); |
| 418 | strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); |
| 419 | - write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); |
| 420 | + write_string_file(filename, "change", 0); |
| 421 | |
| 422 | return 0; |
| 423 | } |
| 424 | diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 425 | index 67dc2e4..01b83d0 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 426 | --- a/src/vconsole/vconsole-setup.c |
| 427 | +++ b/src/vconsole/vconsole-setup.c |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 428 | @@ -116,7 +116,7 @@ static int toggle_utf8(const char *name, int fd, bool utf8) { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 429 | static int toggle_utf8_sysfs(bool utf8) { |
| 430 | int r; |
| 431 | |
| 432 | - r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); |
| 433 | + r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); |
| 434 | if (r < 0) |
| 435 | return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); |
| 436 | |
| 437 | -- |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 438 | 2.11.0 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 439 | |