summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Down <chris@chrisdown.name>2018-12-12 15:58:46 +0100
committerLennart Poettering <lennart@poettering.net>2018-12-12 20:47:40 +0100
commite92aaed30e0b5750e5633765f1bddd51c96678e5 (patch)
treeb568cc092a868d3a4226f529e943d3cde8e72f82
parentMerge pull request #10892 from mbiebl/revert-systemctl-runtime-unmask-breakage (diff)
downloadsystemd-e92aaed30e0b5750e5633765f1bddd51c96678e5.tar.xz
systemd-e92aaed30e0b5750e5633765f1bddd51c96678e5.zip
tree-wide: Remove O_CLOEXEC from fdopen
fdopen doesn't accept "e", it's ignored. Let's not mislead people into believing that it actually sets O_CLOEXEC. From `man 3 fdopen`: > e (since glibc 2.7): > Open the file with the O_CLOEXEC flag. See open(2) for more information. This flag is ignored for fdopen() As mentioned by @jlebon in #11131.
-rw-r--r--src/basic/fileio.c2
-rw-r--r--src/basic/tmpfile-util.c2
-rw-r--r--src/boot/bootctl.c2
-rw-r--r--src/core/load-fragment.c2
-rw-r--r--src/core/smack-setup.c6
-rw-r--r--src/coredump/coredump.c2
-rw-r--r--src/fsck/fsck.c2
-rw-r--r--src/machine/machine-dbus.c2
-rw-r--r--src/machine/machined-dbus.c2
-rw-r--r--src/network/test-routing-policy-rule.c6
-rw-r--r--src/nspawn/nspawn-setuid.c4
-rw-r--r--src/portable/portable.c2
-rw-r--r--src/portable/portabled-image-bus.c2
-rw-r--r--src/shared/dissect-image.c2
-rw-r--r--src/shared/exec-util.c2
-rw-r--r--src/shared/install.c2
-rw-r--r--src/shared/os-util.c2
17 files changed, 22 insertions, 22 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 4c200f8393..11972a6213 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -156,7 +156,7 @@ int write_string_file_ts(
goto fail;
}
- f = fdopen(fd, "we");
+ f = fdopen(fd, "w");
if (!f) {
r = -errno;
safe_close(fd);
diff --git a/src/basic/tmpfile-util.c b/src/basic/tmpfile-util.c
index dba0492ba8..669eb2666c 100644
--- a/src/basic/tmpfile-util.c
+++ b/src/basic/tmpfile-util.c
@@ -36,7 +36,7 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) {
return -errno;
}
- f = fdopen(fd, "we");
+ f = fdopen(fd, "w");
if (!f) {
unlink_noerrno(t);
free(t);
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index 2008341f63..fc4726e69a 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -823,7 +823,7 @@ static int install_loader_config(const char *esp_path) {
if (fd < 0)
return log_error_errno(fd, "Failed to open \"%s\" for writing: %m", p);
- f = fdopen(fd, "we");
+ f = fdopen(fd, "w");
if (!f) {
safe_close(fd);
return log_oom();
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 36e874de29..fc5644f489 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -4415,7 +4415,7 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {
free_and_replace(*filename, target);
}
- f = fdopen(fd, "re");
+ f = fdopen(fd, "r");
if (!f) {
safe_close(fd);
return -errno;
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
index 4bb2051aa3..49b37aefc7 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
@@ -72,7 +72,7 @@ static int write_access2_rules(const char* srcdir) {
continue;
}
- policy = fdopen(fd, "re");
+ policy = fdopen(fd, "r");
if (!policy) {
if (r == 0)
r = -errno;
@@ -154,7 +154,7 @@ static int write_cipso2_rules(const char* srcdir) {
continue;
}
- policy = fdopen(fd, "re");
+ policy = fdopen(fd, "r");
if (!policy) {
if (r == 0)
r = -errno;
@@ -227,7 +227,7 @@ static int write_netlabel_rules(const char* srcdir) {
continue;
}
- policy = fdopen(fd, "re");
+ policy = fdopen(fd, "r");
if (!policy) {
if (r == 0)
r = -errno;
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index 79d627c465..0c888b26f9 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -553,7 +553,7 @@ static int compose_open_fds(pid_t pid, char **open_fds) {
if (fd < 0)
continue;
- fdinfo = fdopen(fd, "re");
+ fdinfo = fdopen(fd, "r");
if (!fdinfo) {
safe_close(fd);
continue;
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 7fc4a283ce..ba39f596fc 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -177,7 +177,7 @@ static int process_progress(int fd) {
if (fd < 0)
return 0;
- f = fdopen(fd, "re");
+ f = fdopen(fd, "r");
if (!f) {
safe_close(fd);
return -errno;
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index 285918b4cc..48270b3709 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -370,7 +370,7 @@ int bus_machine_method_get_os_release(sd_bus_message *message, void *userdata, s
pair[1] = safe_close(pair[1]);
- f = fdopen(pair[0], "re");
+ f = fdopen(pair[0], "r");
if (!f)
return -errno;
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index d613414fde..9afae72ae5 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -615,7 +615,7 @@ static int clean_pool_done(Operation *operation, int ret, sd_bus_error *error) {
if (lseek(operation->extra_fd, 0, SEEK_SET) == (off_t) -1)
return -errno;
- f = fdopen(operation->extra_fd, "re");
+ f = fdopen(operation->extra_fd, "r");
if (!f)
return -errno;
diff --git a/src/network/test-routing-policy-rule.c b/src/network/test-routing-policy-rule.c
index f80f3c09a9..57bfb6af68 100644
--- a/src/network/test-routing-policy-rule.c
+++ b/src/network/test-routing-policy-rule.c
@@ -28,14 +28,14 @@ static void test_rule_serialization(const char *title, const char *ruleset, cons
fd = mkostemp_safe(pattern);
assert_se(fd >= 0);
- assert_se(f = fdopen(fd, "a+e"));
+ assert_se(f = fdopen(fd, "a+"));
assert_se(write_string_stream(f, ruleset, 0) == 0);
assert_se(routing_policy_load_rules(pattern, &rules) == 0);
fd2 = mkostemp_safe(pattern2);
assert_se(fd2 >= 0);
- assert_se(f2 = fdopen(fd2, "a+e"));
+ assert_se(f2 = fdopen(fd2, "a+"));
assert_se(routing_policy_serialize_rules(rules, f2) == 0);
assert_se(fflush_and_check(f2) == 0);
@@ -46,7 +46,7 @@ static void test_rule_serialization(const char *title, const char *ruleset, cons
fd3 = mkostemp_safe(pattern3);
assert_se(fd3 >= 0);
- assert_se(f3 = fdopen(fd3, "we"));
+ assert_se(f3 = fdopen(fd3, "w"));
assert_se(write_string_stream(f3, expected ?: ruleset, 0) == 0);
cmd = strjoina("diff -u ", pattern3, " ", pattern2);
diff --git a/src/nspawn/nspawn-setuid.c b/src/nspawn/nspawn-setuid.c
index 86fd9deec0..0026e4e3fc 100644
--- a/src/nspawn/nspawn-setuid.c
+++ b/src/nspawn/nspawn-setuid.c
@@ -91,7 +91,7 @@ int change_uid_gid(const char *user, char **_home) {
if (fd < 0)
return fd;
- f = fdopen(fd, "re");
+ f = fdopen(fd, "r");
if (!f)
return log_oom();
fd = -1;
@@ -164,7 +164,7 @@ int change_uid_gid(const char *user, char **_home) {
if (fd < 0)
return fd;
- f = fdopen(fd, "re");
+ f = fdopen(fd, "r");
if (!f)
return log_oom();
fd = -1;
diff --git a/src/portable/portable.c b/src/portable/portable.c
index 5b62486ea9..920bd866f5 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -1089,7 +1089,7 @@ static int test_chroot_dropin(
return log_debug_errno(errno, "Failed to open %s/%s: %m", where, p);
}
- f = fdopen(fd, "re");
+ f = fdopen(fd, "r");
if (!f)
return log_debug_errno(errno, "Failed to convert file handle: %m");
fd = -1;
diff --git a/src/portable/portabled-image-bus.c b/src/portable/portabled-image-bus.c
index 1e618175c7..360559811f 100644
--- a/src/portable/portabled-image-bus.c
+++ b/src/portable/portabled-image-bus.c
@@ -73,7 +73,7 @@ static int append_fd(sd_bus_message *m, PortableMetadata *d) {
assert(d);
assert(d->fd >= 0);
- f = fdopen(d->fd, "re");
+ f = fdopen(d->fd, "r");
if (!f)
return -errno;
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index 4e572ac861..6ea8e4df8d 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -1300,7 +1300,7 @@ int dissected_image_acquire_metadata(DissectedImage *m) {
fds[2*k+1] = safe_close(fds[2*k+1]);
- f = fdopen(fds[2*k], "re");
+ f = fdopen(fds[2*k], "r");
if (!f) {
r = -errno;
goto finish;
diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c
index d66b300459..17a278a00f 100644
--- a/src/shared/exec-util.c
+++ b/src/shared/exec-util.c
@@ -308,7 +308,7 @@ static int gather_environment_consume(int fd, void *arg) {
assert(env);
- f = fdopen(fd, "re");
+ f = fdopen(fd, "r");
if (!f) {
safe_close(fd);
return -errno;
diff --git a/src/shared/install.c b/src/shared/install.c
index 822645ef43..51d33b80e9 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1286,7 +1286,7 @@ static int unit_file_load(
if (r < 0)
return r;
- f = fdopen(fd, "re");
+ f = fdopen(fd, "r");
if (!f)
return -errno;
fd = -1;
diff --git a/src/shared/os-util.c b/src/shared/os-util.c
index f7d46d3c47..b2d5ce32e7 100644
--- a/src/shared/os-util.c
+++ b/src/shared/os-util.c
@@ -74,7 +74,7 @@ int fopen_os_release(const char *root, char **ret_path, FILE **ret_file) {
if (r < 0)
return r;
- f = fdopen(fd, "re");
+ f = fdopen(fd, "r");
if (!f)
return -errno;
fd = -1;